How i can close/exit button on my app?

前端 未结 6 1727
慢半拍i
慢半拍i 2021-01-23 20:45

i have a button to close my app with this code:

finish();

the problem is that this button doesn\'t exit of my app... it simply closes the current intent ant retu

6条回答
  •  自闭症患者
    2021-01-23 21:32

    If you really want your app to die. You could initiate each intent with startActivityForResult(). then before each finish() set the result to send back. in each parent activity you can override onActivityResult() to test whether the result received means the application needs to end. if so you can call another set result and finish(). repeat this in all activities and you will find that your application terminates entirely.

    Incidentally I'm writing this from memory. function names may not be exact.

    Hope that helps.

    p.s. re-read your requirements. you can always stop the finish loop at your first activity.

提交回复
热议问题