Reputation: 77
I want to make OK button on my DatePickerDialog to open TimePickerDialog instead of just dismissing itself. How can I call the OK button on the DatePickerDialog to open a new dialog when finished instead of dismissing?
Upvotes: 1
Views: 4059
Reputation: 791
Try getButton
from DatePickerDialog
.
Example:
DatePickerDialog dialog = new DatePickerDialog(CalendarApp.this, android.R.style.Theme_Holo_Light_Dialog, mDateSetListerner, year, month, dayOfMonth);
dialog.show();
Button button1 = (Button) dialog.getButton(dialog.BUTTON_POSITIVE);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getBaseContext(), "Oswal" , Toast.LENGTH_LONG).show();
Intent intent = new Intent(getApplicationContext(), TodoList.class);
startActivity(intent);
}
});
Upvotes: 0
Reputation: 5841
You get a callback from DatePickerDialog
when user presses "OK". You just need to override onDateSet
method, and there do whatever stuff you want.
@Override
public void onDateSet(DatePicker objPicker, int year, int monthOfYear, int dayOfMonth) {
// open your second dialog or do anything you want
}
Upvotes: 3