I'm currently in a different Activity. How can I get the main launch Activity's Intent?
Intent launchIntent = getIntent();
In the above, obviously getIntent()
would not get me the correct Intent
that I need.
How can I get the main launch Activity
's Intent
?
import android.os.Bundle;
Bundle extras = getIntent().getExtras();
if (extras != null) {
pics = extras.getInt(KEY_HERE);
}
Replace pics and getInt as needed.
When Activity1
loads, grab the Bundle
associated with it's launch.
When Activity2
is launched, put these same extras into your new Intent
, and pass it on to Activity2
.
You can't just access an Intent
from a different activity, you need to pass the information along.