Reputation: 3897
I have an application that contains 3 activities A, B and C. The activity A is the one that gets started when I start my app. From A I start B using mIntent.setClass(A.this, B.class);
, then startActivity(mIntent);
this goes well. What goes wrong is when I want to start the activity C from B.
this how the manifestfile looks like:
<activity android:name=".B"/>
<activity android:name=".C"/>
I know that I can do the follwoings: start B from A and then from B go back to A and then start C
or let B has its own manifestfile thus a stand lone app, and let C be an activity within this app.
Any suggestion is welcome. My apoligies for my bad english.
thank you
Upvotes: 0
Views: 7352
Reputation: 576
mIntent goes null if you don't get it in your B activity. So inside B, you shloud initialize mIntent.
You can do this for instance
startActivity(new Intent(this, C.class));
Upvotes: 1
Reputation: 36806
The error you posted in the comments is a NullPointerException which means some variable you're calling a method on (or attempting to access a property of, etc) has not yet been instantiated. Is it possible that you're declaring mIntent but not setting it to a new Intent before calling setClass? Post the code for class B, and it should be pretty easy to figure out (NullPointerExceptions usually are).
Upvotes: 1
Reputation: 1086
Since you're doing this in onCreate, did you call super.onCreate before (attempting to) starting this new Activity?
Upvotes: 0