Reputation: 13140
Suppose I have two Activity classes in my Android app. Inside Activity B, I know that Activity A exists and is instantiated. What's the proper way to access Activity object A from Activity object B?
Upvotes: 2
Views: 2013
Reputation: 53496
How can you know Activity A is still around? You can't, the OS handles that and you should not assume to know anything about another activity other than the one that's in the foreground.
If you want to pass data around, use Intents or in some cases, just use static variables.
Upvotes: 2
Reputation: 43098
You cannot access the activity directly. The only mechanism of passing data between activities is Intent mechanism.
Upvotes: 1