java - 如何保护 Android 中的 Activity

标签 java android protected

我想保护我的 Activity 类不允许在另一个包中使用,例如,如果有一个用户主页 Activity ,则只有在用户正确登录时才应该能够调用它,但是 protected android 中不允许,那么我该怎么做?

最佳答案

您可以为your manifest中的 Activity 设置android:exported="false" :

android:exported
Whether or not the activity can be launched by components of other applications — "true" if it can be, and "false" if not. If "false", the activity can be launched only by components of the same application or applications with the same user ID.

关于java - 如何保护 Android 中的 Activity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19159462/

相关文章:

java - 重置 eclipse rcp 中保存的状态

java - 如何添加在其他地方创建的对象作为 Dagger 依赖项?

java - 如何使 ".bat"文件使用某个文本文件的文本作为命令

如果没有足够的空间,android按钮布局smarty两行

c# - 无论如何要创建一个变量 "partially protected"?

java - JQuery验证引擎: Validate with Ajax call

java - java的用户注册框架

android - 如何使用软键盘强制 View 底部的按钮向上移动?

c++ - 相同模板类但不同模板类型的 protected 成员

python - 在 Python 中访问 "Protected"- 怎么样?