Reputation: 9439
I have two activities A and B. Activity A starts activity B. Now I'm in B, how to call A's function?
Upvotes: 0
Views: 1755
Reputation: 42849
Well, you can't...but what you can do is this:
BaseActivity
with the functionality you want in both A and B, and then have both A and B extend this class.The first way is probably preferred, as it may be difficult to get your common code class into the activities.
Upvotes: 1
Reputation: 24722
Unless function is static you are out of luck. I suggest that you place necessary functions in Application object or make them static.
Note that activity not on top of the stack can be destroyed at any time.
Upvotes: 4