How to Prevent an Alert Dialog Getting Closed by Back Button

后端 未结 3 2066
一个人的身影
一个人的身影 2021-02-12 19:19

I have an alert dialog like this:

    AlertDialog.Builder oyunaBaslaDialog = new AlertDialog.Builder(this);
    oyunaBaslaDialog.setMessage(\"A Takımı\");
    oy         


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-12 20:14

    Use Dialog.setCancelable():

    Sets whether this dialog is cancelable with the BACK key.

    In your code this would be:

    oyunaBaslaDialog.setCancelable(false);
    

提交回复
热议问题