Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sarra Sakka
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :



Here's the AndroidManifest.xml:

Here's the code :
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sarra Sakka
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Steve
the second method work very well
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic