隐藏的onStop前的看法? [英] Hide a view before onStop?

查看:154
本文介绍了隐藏的onStop前的看法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户preSS home键的onStop()方法被调用和系统需要截图可以打开的应用程序中可以看出,当用户preSS按住home键(在Android手机)。
我的问题是如何prevent敏感数据是任何人谁可以采取电话和preSS按住home键可见?
试想一下,应用程序(活动)presents秘密文件和用户preSS home键的preVIEW(也许有人只是走近用户,他不希望任何人看到他的秘密文件)。但是,任何人谁后,需要一个手机可以preSS按住home键,看到一些敏感的数据。

我试图隐瞒观点的onPause和/或的onStop,但不起作用。
因此,系统的onStop后才能截图之前如何删除当前可见的看法?

感谢。


解决方案

  

我的问题是如何prevent敏感数据是任何人谁可以采取电话和preSS按住home键可见?


自己:


  

然而,对于用户的利益,有可能是原因阻止特定的活动的屏幕截图。要做到这一点,使用 FLAG_SECURE


 公共类FlagSecureTestActivity延伸活动{
  @覆盖
  公共无效的onCreate(捆绑savedInstanceState){
    super.onCreate(savedInstanceState);    getWindow()。setFlags(LayoutParams.FLAG_SECURE,
                         LayoutParams.FLAG_SECURE)​​;    的setContentView(R.layout.main);
  }
}

When user press home button onStop() method is called and system takes screenshot which can be seen among open applications when user press and hold home button(on android phones). My question is how to prevent sensitive data to be visible to anybody who can take a phone and press and hold home button? Imagine, application(activity) presents a preview of secret document and user press home button(maybe somebody just approached to the user and he doesn't want to anybody see his secret document). However, anybody who takes a phone after that can press and hold home button and see some sensitive data.

I tried to hide view onPause and/or onStop but that doesn't work. So, how to remove current visible view before system takes screenshot after onStop?

Thanks.

解决方案

My question is how to prevent sensitive data to be visible to anybody who can take a phone and press and hold home button?

Quoting myself:

However, for the user’s benefit, there may be reasons to block screenshots from certain of your activities. To do that, use FLAG_SECURE:

public class FlagSecureTestActivity extends Activity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().setFlags(LayoutParams.FLAG_SECURE,
                         LayoutParams.FLAG_SECURE);

    setContentView(R.layout.main);
  }
}

这篇关于隐藏的onStop前的看法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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