java - Android alert dialog Issue -


in android application, use 1 alert dialog display information user, , if user click dialog , should finish activity. code

offer.this.runonuithread(new runnable() { @override public void run() {     // todo auto-generated method stub     alertdialog alert=new alertdialog.builder(offer.this).create();     alert.settitle("svsugar mill");     alert.setmessage("offer number "+offer_no.gettext().tostring());     alert.setbutton("click dismiss", new dialoginterface.onclicklistener() {     @override     public void onclick(dialoginterface dialog, int which) {         // todo auto-generated method stub         finish();         //return;         }     });     alert.show();     } }); 

it doesn't wait user response finish(). instead called if user didn't click alert dialog. know asynchronous, need this.(the offerno should displayed user. when user click alert dialog should finish activity). there way this?

someone me

edit:

the activity finished without waiting user click alert dialog

public void showdialog(final context context) {         new alertdialog.builder(context)                 .settitle(android.r.string.dialog_alert_title)                   .setmessage(ucontext.getcontext().getstring(r.string.network_error))                 .setpositivebutton(android.r.string.ok,                         new dialoginterface.onclicklistener() {                             @override                             public void onclick(dialoginterface dialog,                                     int which) {                                 this.finish();                             }                         }).show();     } 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -