I play Android Studio, so I created the SettingsActivity application using the wizard, and I ran into a problem that made it impossible to switch from this settings activity to the main activity using the up arrow in the action bar.
The action bar setup looks like this:
private void setupActionBar() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) {
Actionbar is not null btw.
And parentActitvityName is set in AndroidManifest:
<activity android:name=".SettingsActivity" android:label="@string/title_activity_settings" android:parentActivityName=".MainActivity"> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.demo.app.MainActivity" /> </activity>
However, clicking on the arrow does nothing. Even onOptionsItemSelected does not work.
This seems to be exactly the same problem. The setDisplayHomeAsUpEnabled action bar does not work on ICS , but switching from part to overview activity works fine in the same application. In addition, I set MinSDK to 15 and TargetSDK to 23.
source share