Saturday, January 25, 2014

Andoird AlertDialog, when the dialog box appears, click on the space outside of the dialog box, the dialog box automatically shut down what events have sample code Thank you


 
private void showNoticeDialog ()
{
/ / Constructor dialog
AlertDialog.Builder builder = new Builder (mContext);
builder.setTitle (R.string.soft_update_title);
builder.setMessage (R.string.soft_update_info);
/ / Update
builder.setPositiveButton (R.string.soft_update_updatebtn, new OnClickListener ()
{
@ Override
public void onClick (DialogInterface dialog, int which)
{
/ / Show download dialog
}
});
/ / Click the Update button
laterbuilder.setNegativeButton (R.string.soft_update_later, new OnClickListener ()
{
@ Override
public void onClick (DialogInterface dialog, int which)
{

/ / Click the Update button later after}
});
/ / Click event outside the margin of the dialog box? ? ? ? ? ?
builder.set???????? (R.string.soft_update_later, new OnClickListener ()
{}
Dialog noticeDialog = builder.create ();
noticeDialog.show ();
}

Click on the event in the space outside of the dialog? ? ? ? ? ?
This event is what

Thank

I want to know that he is the point of the "update", "update later", or "dialog box outside the space"

Thank you
Reply:
noticeDialog.setCanceledOnTouchOutside (true), so you click on the area outside the dialog, dialog will be cancel out.
builder.setOnCancelListener (), cancel out when invoked here callbak, as long as you are at the point of the "update", "update later", or "dialog box outside the space" were to be marked in this callback will be able to where resolution is the kind of situation.
Reply:
builder.setCancelable (false); do not know is not the result you want
Reply:
cited a floor tantahe reply:
noticeDialog.setCanceledOnTouchOutside (true), so you click on the area outside the dialog, dialog will be cancel out.
builder.setOnCancelListener (), cancel out when invoked here callbak, as long as you are at the point of the "update", "update later", or "dialog box outside the space" were to be marked in this callback will be able to where resolution is the kind of situation.
Positive Solutions
Reply:
cited a floor tantahe reply:
noticeDialog.setCanceledOnTouchOutside (true), so you click on the area outside the dialog, dialog will be cancel out.
builder.setOnCancelListener (), cancel out when invoked here callbak, as long as you are at the point of the "update", "update later", or "dialog box outside the space" were to be marked in this callback will be able to where resolution is the kind of situation.

+1
Reply:
cited a floor tantahe reply:
noticeDialog.setCanceledOnTouchOutside (true), so you click on the area outside the dialog, dialog will be cancel out.
builder.setOnCancelListener (), cancel out when invoked here callbak, as long as you are at the point of the "update", "update later", or "dialog box outside the space" were to be marked in this callback will be able to where resolution is the kind of situation.

+1

No comments:

Post a Comment