how to declare two packages with their activities in androidmanifest.xml ?

Sarra Sakka

Ranch Hand

Posts: 283

posted 3 years ago

I created two packages, one "com.application.login.Login" contains the login class it is an activity, and the other "com.application.activity.MainActivity" the Mainactivity it's also an activity.
The launcher activity is the Login then when i clicked on button "Login" the MainActivity appears, i haven't problem in this step but ,
when i pressed a button in the mainactivity to return to the Login interface, the logcat display an error :

There are a couple ways to create an intent. You are using an action to do so when you do this:

To make that work, you need to add an additional intent filter to the activity. You know how to do that because you did it for the main activity.

The other way (and the way I would choose to do it would be to create an explicit intent to the activity, using a context (the current Activity) and the other Activity's class:

The difference is who can call your Activity. If you use the first method, then other applications could call your Activity, while the explicit call can only be used from the same application. I generally use the second method except for those few launch-points I want to have to enter my app.