How to call a Date picker dialog inside the Dialog's button
I have created an Activity which has a dialog, this dialog has an EditText fiel开发者_StackOverflowd with Button. Now, on button click I have to show a Date Picker. How can I do this?
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext());
builder.setMessage("Are you sure? Continue will exit the app")
.setCancelable(false)
.setPositiveButton("Continue & exit",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// Add your data picker code here.
}
})
.setNegativeButton("Return", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
});
精彩评论