I am trying to get my first DatePickerDialog working but bizarrely,
the app keeps crashing just as my onDateSet() function is encountered.
My code is below:
protected Dialog onCreateDialog(int id){
//super.onCreateDialog(id);
Log.e("TRACKING", "Just outside onDateSet()");
switch(id){
case DATE_DIALOG_ID:
Log.e("TRACKING", "entering onDateSet()");
final TextView dob =
(TextView)findViewById(R.id.DOB);
Log.e("TRACKING", "reaching#1");
DatePickerDialog dateDialog =
new DatePickerDialog(this, new
DatePickerDialog.OnDateSetListener() {
@Override
public void
onDateSet(DatePicker view, int year,
int
monthOfYear, int dayOfMonth) {
// TODO Auto-generated
method stub
}
/*...@override
public void
onDateSet(DatePicker view, int year, int
monthOfYear, int dayOfMonth){
Log.e("TRACKING",
"reaching#2");
// TODO Auto-generated
method stub
Time dateOfBirth
= new Time();
dateOfBirth.set(dayOfMonth, monthOfYear, year);
long dtDob
= dateOfBirth.toMillis(true);
dob.setText(DateFormat.format("MMMM dd yyyy", dtDob));
Editor editor =
mGameSettings.edit();
editor.putLong(GAME_PREFERENCES_DOB, dtDob);
editor.commit();
}
}, 0, 0, 0);
Log.e("TRACKING", "end of onDateSet()");
return dateDialog;
//return new DatePickerDialog(this,
mDateSetListener, 0, 0,
0);
default:
break;
}
return null;
}
As normal, I call my dialog by showDialog(DATE_DIALOG_ID);
The log message Log.e("TRACKING", "reaching#2"), is never logged.
Please help!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en