在Android 4.2禁用主页按钮 [英] Disabling home button on android 4.2

查看:91
本文介绍了在Android 4.2禁用主页按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想禁用home键在Android 4.2至prevent用户关闭应用程序。我看,我不能直接赶上4.2 home键事件,所以我可能需要实现一些主屏幕应用?我不知道是否有任何样品code简单地显示这个功能(目的不是让用户关闭重新运行上键,该程序program.maybe)。

I would like to disable home button on android 4.2 to prevent user from closing the application. I read that I can't directly catch home button event on 4.2 so I may need to implement some home screen application?? I was wonder if there is any sample code to simply show this functionality ( Goal is not allowing the user to close the program.maybe rerun the program on key down).

在此先感谢您的帮助, 雷

Thanks in advance for the help, Ray

推荐答案

请您的应用程序是主屏幕。然后,pressing HOME将用户返回到您的应用程序。有一个在你的SDK安装一个家庭SDK示例(如果你选择下载SDK样本)。基本上,你需要一个<意向滤光器> 您的活动,如:

Make your app be the home screen. Then, pressing HOME will return the user to your app. There is a Home SDK sample in your SDK installation (if you chose to download SDK samples). Basically, you need an <intent-filter> on your activity like:

        <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>

这篇关于在Android 4.2禁用主页按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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