Reputation: 5259
Hopefully this is very simple.
I have a central activity that can be launched from two separate classes. I was hoping that in this central activity I could have an IF statement like
if(this.getIntent() == MainMenu.class)
{
// Do something here
}
But obviously that isn't legal so how could I structure an expression to check from what class an intent was started.
Many thanks
Upvotes: 2
Views: 2101
Reputation: 69228
I think you may put a parameter into intent and then just compare against that (following is pseudocode):
intent.putExtra("starter", 1)
and then just compare in your central activity:
if (intent.getIntExtra("starter") == 1) { ... }
Upvotes: 2
Reputation: 5784
Why don't you pass something along as an extra using Intent#putExtra
and then retrieve it in the central activity using Intent#getExtra
?
Upvotes: 0