Prompt user when Back button is pressed

前端 未结 5 1009
孤街浪徒
孤街浪徒 2021-02-13 16:01

Which is the good place to ask user, whether (s)he wants to exit the app when (s)he clicked the back button? I considered the onPause and onStop, but t

5条回答
  •  南笙
    南笙 (楼主)
    2021-02-13 16:12

    The best place is in the onBackPressed. the only thing you need to keep in mind is that the app behaves 'normally' - that is when the user pressed back they should go to the previous screen - if they press back on the main screen, then it's good to ask if they meant to quit the app.

提交回复
热议问题