Check status of dialog in android -
i create dialog by:
protected void showalertdialog(string title, string message) { alertdialog.builder builder = new builder(this); if(title != null) { builder.settitle(title); } if(message != null) { builder.setmessage(message); } builder.setpositivebutton("ok", new onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { backtomainactivity(); } }); builder.show(); }
and after use in activity. how can check status dialog. mean want check when dialog canceled or closed. way that? have example when user click backbutton , dialog closed , want finish activity when dialog closed. way check if dialog showing or closed?
you may add cancel button dialog:
builder.setnegativebutton("cancel", new onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { //your code here } });
if want dialog ok button may else using such methods - setoncancellistener, setondissmislistener on builder.
Comments
Post a Comment