How to make alertDialog not lose focus until dismiss() is called
alertDialog closes when I minimize my app. I don't want it to until
alertBuilder.dismiss() is called. Also my
alertBuilder depends on some user inputs so its not possible to open it again on activity resume. So how not to lose focus of it?
EDIT: My alertBuilder has some links in it and when user presses on one of the links,it is redirected to another app and then the alertBuilder closes.I want this not to happen.Please help me.
You can setCancelable(false) on your alert dialog.
AlertDialog dialog = new AlertDialog.Builder(this) .setTitle("Your Title") .setMessage("Your Message") .setCancelable(false) .setPositiveButton("OK",null)//optional .show();
This way alert dialog does not close on activity minimize or back press.
Clicking positive or negative button finally dismisses alert dialog so these buttons might be provisions to dismiss the alert dialog.
You can supply null as onClickListener parameter, if don't want to execute any code on button click. This also dismisses alert dialog.