tags:

views:

58

answers:

2
+2  Q: 

activity parent

Hi,

Can someone tell if why when starting an activity with startActivity(intent) , calling getParent() in onCreate() of the new created activity returns a nul ?

Also how could I obtain the parent of an activity created in such a way ? Can a reference of the activity below the current activity in the activity stack be obtained ?

A: 

You may not be able to get an Activity object of the launching activity by design, because there is no guarantee it will exist in that form. The OS is able to suspend and recreate Activities that are not currently in view.

Jim Blackler
+3  A: 

Can someone tell if why when starting an activity with startActivity(intent) , calling getParent() in onCreate() of the new created activity returns a nul ?

Because the activity does not have a parent. The notion of parent activities is only used by ActivityGroup.

Can a reference of the activity below the current activity in the activity stack be obtained ?

No, sorry.

CommonsWare