Skip to content Skip to sidebar Skip to footer

Do Not Close The Alertdialog By Clicking On A Button - Android

I've an alertdialog any options and with 2 buttons. I don't want close the dialog when I push on the second button (only stop a sound). Is there any property to maintain the dialog

Solution 1:

I guess, You are displaying AlertDialog, with default buttons Positive and Negative. instead, you can create a Dialog, and set a layout as contentView of this dialog, with having two buttons, manually. Here you would need to define all the definition of the button click event, and no default button will occur. So, If you are not dismissing dialog on a button click, simply dont invoke dialog.dismiss(), on button click.

Edit: Neutral Button by default dismiss the dialog, try changing it as negative button, if it still wont work, then please apply solution, I have written above.

Post a Comment for "Do Not Close The Alertdialog By Clicking On A Button - Android"