Set Action for home button in android

后端 未结 3 1990
余生分开走
余生分开走 2021-01-23 11:39

How I can change working of home button in android? I want to when I click on home button I do some actions and after that application should go to background. How I can do that

3条回答
  •  礼貌的吻别
    2021-01-23 12:40

    Write your own home screen. When the user presses HOME, they will get a choice of running your app or the built-in home screen. They can elect to choose one just this one time, or set either app as being their default from now on. Many will wonder why on Earth you decided to decided to implement a home screen.

    Most developers care about any case where their activity moves to the background, in which case you can either use a lifecycle method (e.g., onPause(), onStop()) or try onUserLeaveHint().

提交回复
热议问题