我想保护我的 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/