0

Is there any way to get the parent activity instance for activities that are not embedded, the same way as for TabBar Activities you can use getParent()? Is there a method or a way to do the same for regular activities, started with a regular intent? I need to get the context, so I can pass it forward.

4

1 回答 1

7

Is there any way to get the parent activity

There is no concept of "parent activities" in Android, except in the now-deprecated ActivityGroup.

I need to get the context, so I can pass it forward.

First, each Activity is a Context. Second, passing Contexts around between component is a recipe for memory leaks. Please solve whatever problem you think you have in some other way.

于 2013-02-16T13:36:53.083 回答