Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Does this code mean that my Main Activity is the hierarchical parent of my Story Activity?
My version of android studio doesn't ask for the hierarchical parent of a new activity when I create it so I had to connect them after I created the new activity and this is to ask if I did it correctly. I was also wondering if I have to connect two activity's after the creation of one through the manifest every time or is there an easier way in the newest version of android studio?
<activity android:name=".StoryActivity"> <meta-data android:name=".MainActivity" android:value="vuorio.miika.interactivestory.MainActivity" />
// The code for the the first question.
Seth Kroger56,407 Points
The hierarchical parent option is available on some activity types (Basic, Settings) but not others (Empty). The manifest code that should be output by the hierarchical parent option is:
<activity android:name=".ui.StoryActivity" android:label="@string/title_activity_story" android:parentActivityName=".ui.MainActivity"> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".ui.MainActivity" /> </activity>