Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMiika Vuorio
8,018 PointsDoes 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.
1 Answer
Seth Kroger
56,414 PointsThe 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>