I have an AlertDialog.Builder but the problem is that when the AlertDialog.Builder is showing I am unable to click on the toolbar becase AlertDialog.Builder is drawn above all other views.. how do I make this AlertDialog.Builder not cancel able but still be able to click on toolbar items.
here is a snapshot for a better understanding
HERE IS MY CODE:
final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
//Set title
builder.setTitle("Approval Pending")
//Set message
.setMessage("Your account with Reference Id [" + jObj0.getString("reference_id") + "] is in Pending state.")
.setNegativeButton("REFRESH", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if(Utils.isConnected(getContext())) {
dialog.dismiss();
fetchdashboardfragmentdata(true);
}else{
builder.show();
Toast.makeText(getContext(), "Please turn on your Internet connection and try again", Toast.LENGTH_SHORT).show();
}
}
})
.setPositiveButton("LOGOUT", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
StoreSharePreference.SSP().logout(getContext());
Intent intent = new Intent(getContext(), Login_Page.class);
intent.setFlags(intent.FLAG_ACTIVITY_CLEAR_TOP | intent.FLAG_ACTIVITY_NEW_TASK | intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
getActivity().finish();
}
})
.setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
return true;
}
return false;
}
})
.setCancelable(false);
AlertDialog alert = builder.create();
alert.show();
--I want to be able to click on cart icon, wishist icon and navigation drawer when the AlertDialog.Builder is showing.--