mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-25 05:44:06 -06:00
19 lines
550 B
Markdown
19 lines
550 B
Markdown
#cs240 #android
|
|
|
|
Sometimes the back button in the app bar is for going to a *parent* activity, not just the last one. Define that in the AndroidManifest.xml:
|
|
|
|
<activity
|
|
name..
|
|
label..
|
|
android:parentActivityName=".ui.MainActivity"
|
|
|
|
Use the following code right after setting up the app bar:
|
|
|
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
|
|
To make sure that the main activity isn't restarted upon return, write the following in the main activity's manifest entry.
|
|
|
|
<activity
|
|
name...
|
|
label...
|
|
android:launchMode="singleTop"> |