Reputation: 96
I am writing this app and I seem to be calling actionBar.setDisplayHomeAsUpEnabled(true) in every Activity I create. I'm wondering if there is a way to set this value in the styles.xml or theme.xml; rather than repeating the same line of code every time.
Upvotes: 0
Views: 401
Reputation: 4375
Another way is you can declare in your AndroidManifest.xml
<activity
android:name=".CurrentActivity"
android:label="@string/title_activity_detailed_forecast"
android:parentActivityName=".MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.youpackage.name.appname.MainActivity" />
</activity>
CurrentActivity is your activity that you are in and MainActivity is your previous activity
Upvotes: 2