I want to protect my activity class to not be allowed to use in another package, for example if have a user homepage activity it is should be able to called only if the user signed in correctly, but the protected
is not allowed in android, so how i can do it?
You can set android:exported="false"
for the activity in your manifest:
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.