Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2011
    Posts
    5
    Rep Power
    0

    Default problem creating new thread

    Hey, I'm new on this web forum. Can anybody explain why I cant set up a new thread myself even though I'm logged in??

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by SeanieSortMeOut View Post
    Hey, I'm new on this web forum. Can anybody explain why I cant set up a new thread myself even though I'm logged in??
    Have you gone to one of the actual forums, such as the New to Java forum? There you should see a "New Thread" button in the upper left, just above all the forum threads. What happens when you press that button?

    Also, moving these hijack posts to the forum Lobby.

  3. #3
    Join Date
    Jan 2011
    Posts
    5
    Rep Power
    0

    Default

    Mmmm Ok I'm just going to post my problem here, hopefully somebody can help. Im trying to create an application which will display both a time and date button from which users can then select from. Below is my code but for some reason I have and error for this line:

    DatePicker.OnDateSetListener d=new DatePicker.OnDateSetListener() {

    Stating that DatePicker.OnDateSetListener cannot be resolved to a type. Can anybody help me with this. Here is the rest of the code.

    package andoid.application;

    import java.text.DateFormat;
    import java.util.Calendar;
    import android.app.Activity;
    import android.app.DatePickerDialog;
    import android.app.TimePickerDialog;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.DatePicker;
    import android.widget.TextView;
    import android.widget.TimePicker;

    public class PurchaseParkingActivity extends Activity {
    DateFormat fmtDateAndTime=DateFormat.getDateTimeInstance();
    TextView dateAndTimeLabel;
    Calendar dateAndTime=Calendar.getInstance();

    DatePicker.OnDateSetListener d=new DatePicker.OnDateSetListener() {
    public void dateSet(DatePicker view, int year, int monthOfYear,
    int dayOfMonth) {
    dateAndTime.set(Calendar.YEAR, year);
    dateAndTime.set(Calendar.MONTH, monthOfYear);
    dateAndTime.set(Calendar.DAY_OF_MONTH, dayOfMonth);
    updateLabel();
    }
    };

    TimePicker.OnTimeSetListener t=new TimePicker.OnTimeSetListener() {
    public void timeSet(TimePicker view, int hourOfDay,
    int minute) {
    dateAndTime.set(Calendar.HOUR, hourOfDay);
    dateAndTime.set(Calendar.MINUTE, minute);
    updateLabel();
    }
    };
    @Override
    public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
    Button btn=(Button)findViewById(R.id.dateBtn);
    btn.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
    new DatePickerDialog(PurchaseParkingActivity.this,
    d,
    dateAndTime.get(Calendar.YEAR),
    dateAndTime.get(Calendar.MONTH),
    dateAndTime.get(Calendar.DAY_OF_MONTH),
    Calendar.SUNDAY).show();
    }
    });
    btn=(Button)findViewById(R.id.timeBtn);
    btn.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
    new TimePickerDialog(PurchaseParkingActivity.this,
    t, "Set the time",
    dateAndTime.get(Calendar.HOUR),
    dateAndTime.get(Calendar.MINUTE),
    true).show();
    }
    });
    dateAndTimeLabel=(TextView)findViewById(R.id.dateA ndTime);
    updateLabel();
    }
    private void updateLabel() {
    dateAndTimeLabel.setText(fmtDateAndTime
    .format(dateAndTime.getTime()));
    }
    }




    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <TextView android:id="@+id/dateAndTime"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    />
    <Button android:id="@+id/dateBtn"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Set the Date"
    />
    <Button android:id="@+id/timeBtn"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Set the Time"
    />
    </LinearLayout>

    Thanks in Advance Sean :)

Similar Threads

  1. Creating new threads from another thread
    By enzom83 in forum Threads and Synchronization
    Replies: 1
    Last Post: 12-03-2010, 11:15 PM
  2. a way for creating a Thread
    By arefeh in forum New To Java
    Replies: 6
    Last Post: 01-02-2010, 06:37 PM
  3. Creating a thread that modifies UI
    By prueba2306 in forum Eclipse
    Replies: 2
    Last Post: 08-01-2008, 02:26 PM
  4. Creating a Thread using the Runnable interface
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-09-2008, 07:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •