Android的收听Home键 [英] Android Listen Home button

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

问题描述

是否有可能唯一听home键,如果应用程序包含了一些默认的意图是什么?我已经检查的生命周期方法,但是当我开始默认的意图和home键就会执行。

Is it possible to listen home button uniquely, if the application contain some default intent? I have checked life cycle method but it will execute when I am starting the default intent and home button.

推荐答案

这是acticity可以有多个意图过滤器。所以在清单中添加这样的另一个意图过滤听来回回home键。

An acticity can have more than one intent filter. so in the manifest add another intent filter like this to listen fro home button.

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.HOME" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

试试这个让我知道

try this let me know

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

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