android - close activity and dialog box on back press -
i have activity has progressdialog box setcancelable(false)
.
i want finish activity dismiss progressdialog box
on backpressed()
.
i have implemented onbackpressed()
below not working.
@override public void onbackpressed() { if(pdialog.isshowing()){ pdialog.dismiss(); } this.finish(); super.onbackpressed(); }
progress dialog code is
pdialog = new progressdialog(mainactivity.this); pdialog.settitle("connecting server"); pdialog.setmessage("updating assignee detail. please wait..."); pdialog.setindeterminate(false); pdialog.setcancelable(false); pdialog.show();
set
pdialog.setcancelable(true);
and rest of code fine.
Comments
Post a Comment