Handle force close?

后端 未结 2 977
眼角桃花
眼角桃花 2020-12-10 09:54

Is there a way to notify an activity/service of a force-close request right before it gets killed?

I mean when the user hits the force close button in Menu >

2条回答
  •  粉色の甜心
    2020-12-10 10:33

    I'm pretty new here and to Android programming in general, so forgive me if this isn't strictly correct. However, my understanding is that the Application Not Responding (ANR) dialog is only displayed if your application is either a) non-responsive or b) has thrown an exception that was not caught.

    In case a) the application will not be able to respond to any force-close notification in a reasonable amount of time since it's already hung up enough to generate the ANR. In case b) your application is already dead.

提交回复
热议问题