在Android主键设置操作 [英] Set Action for home button in android

查看:111
本文介绍了在Android主键设置操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能改变机器人的工作home键?我想,当我点击主页按钮我做一些动作,而且申请后应到后台。我怎样才能做到这一点。

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.

推荐答案

写自己的主屏幕。当用户presses HOME,他们将获得运行你的应用程序的选择还是内置的主屏幕。他们可以选择选择一个只是这一次,或设置两种应用程序作为其默认从现在开始。许多人会问,为什么在地球上,你毅然决定实施主屏幕。

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.

大多数开发人员关心,他们的活动转移到任何背景的情况下,在这种情况下,你可以使用一个生命周期方法(例如,的onPause()的onStop()),或尝试 onUserLeaveHint()

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().

这篇关于在Android主键设置操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆