Search code examples
androiddialogback-buttoneula

EULA can be skipped by pressing back button (Android)


I made an Android App that contains an EULA, to make the EULA I used the Dialog class (android.app.Dialog). But when the EULA shows, to not agree to it (escape it) you can press the Back Button which isn't very good and definitely not what I want to happen.

I want to use the Dialog class because it really helps keep my code short and simple(I tried making another activity instead of Dialog)

Any ideas of how to prevent skipping EULA?

-Please Help


Solution

  • Referring to the doc, you can disable the back button behaviour by setting

    dialog.setCancelable(false);