user1506273
user1506273

Reputation: 3

How to disable BACKKEY when an alertbox is called

I am developing an android app in which alert box is called on click of a button. I want that when alert box is displayed it should not disappear without answering to it. Not even by pressing BACK KEY . Only when button on alert box is pressed it should act only then otherwise not. Thank you please reply soon Urgent.

Upvotes: 0

Views: 82

Answers (2)

Bhargav Panchal
Bhargav Panchal

Reputation: 1179

Hi write your code inside this method

public AlertDialog.Builder setOnCancelListener (DialogInterface.OnCancelListener onCancelListener)

or

setCancelable(boolean)

Upvotes: -1

Carnal
Carnal

Reputation: 22064

myAlertBox.setCancelable(false);

Upvotes: 5

Related Questions