Android: Show toast after finishing application / activity

后端 未结 2 1081
醉酒成梦
醉酒成梦 2021-01-18 10:12

I want to show a simple toast, when exiting an application. The problem is, that the toast is not shown. I assume it is because the acitivity is finished or because of

2条回答
  •  迷失自我
    2021-01-18 11:03

    It is advisable that you call finish to close your application rather than calling System.exit(0); since this approach will kill your application completely.System.exit() kills your entire process. finish() just hides, stops and destroys your activity. Your process is still running.

    You can just use finish(); to close your activity and this should solve your problem.

    http://groups.google.com/group/android-developers/browse_thread/thread/63de8a9cdffa46a3?pli=1

提交回复
热议问题