Android App Exit Button

后端 未结 10 1291
鱼传尺愫
鱼传尺愫 2020-12-18 02:07

I\'m not sure whether I need to add an exit button to my app. Is there any point to doing this? And if on exiting one activity or service is not .finish() or closed properly

10条回答
  •  清酒与你
    2020-12-18 02:37

    You don't need to add en exit button. If you don't, your activity will just be kept in memory until the system reclaims it. It will not consume any cpu.

    Of course, if you have any worker threads running you should stop them in onStop() or onPause(), depending on what your threads are doing.

    Many applications add an exit button, for some reason. I guess the reason is that they don't trust themselves to write proper code or they don't trust the Android OS to clean up properly.

    Not going through the correct finish procedures will not cause any damage to others than yourself.

提交回复
热议问题