之后pressing'家'应该开始我Startactivity简历 [英] Resume after pressing 'Home' should start my Startactivity

查看:114
本文介绍了之后pressing'家'应该开始我Startactivity简历的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的应用程序有一个密码查询。这应该显示在每个应用程序启动时或恢复。​​

I want my app to have a password-query. This should be displayed every time the app is started or resumed.

因此​​,我宣布一个Startactivity显示密码提示。如果用户通过pressing'Back'硬件按钮关闭应用程序有些时候,一切都很好。 但是,如果用户暂停用pressing家的应用程序,该应用程序打开的活动之前显示不显示我的提示。

So I have declared a Startactivity that shows a password prompt. If the user closes the App by pressing 'Back'-hardware Button some times everything is fine. But if the user pauses the app by pressing 'Home' the app opens in the activity displayed before without showing my prompt.

1)什么是实现这个,因为我想最好的方法是什么?也许在做每一项活动的东西的onStop(),但是这就是所谓经常,不是只有当应用程序被家休息。

1)What is the best way to implement this as I want? Maybe doing something in OnStop() of each activity but this is called to often, not only when the app is closed by 'Home'.

2)是否有任何其他的方式来关闭应用程序,以便不显示我的PROMT?我在哪里要注​​意?

2)Is there any other way to close the app so that my promt is not displayed? Where do I have to pay attention?

感谢和问候, 直到

推荐答案

如果你想清楚你的活动栈每次用户带来了$ P $后,该应用脱颖而出地面pssing home键和passowrd屏幕顶部的设置安卓clearTaskOnLaunch =真正的在清单中,并设置&LT应用程序标记;类机器人:名称=android.intent.category。启动器/> Startactivity

If you want to clear your activity stack everytime the user brings the app to fore-ground after pressing the home key and the passowrd screen to top the set android:clearTaskOnLaunch="true" in the application tag in the manifest and set <category android:name="android.intent.category.LAUNCHER" /> for your Startactivity

这篇关于之后pressing'家'应该开始我Startactivity简历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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