Android Action Bar navigation up button not working on devices
You should use a meta data tags for Up button to work on older APIs:
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="MainActivity" />
EDIT:
You already have the parentActivityName, so add only the meta tag to your AndroidManifest.xml
file's tags. Like so:
<activity
android:name="in.datumdata.hosurdata.MovieActivity"
android:label="Movie Details"
android:parentActivityName="in.datumdata.hosurdata.MainActvity"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="in.datumdata.hosurdata.MainActvity" />
</activity>
Where you do this:
getActionBar().setDisplayHomeAsUpEnabled(true);
Try doing this:
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
If your activity gets called from multiple activities and specifying parent activity doesn't fit your use case, then you can fix it by adding this:
getSupportActionBar().setDisplayHomeAsUpEnabled(true); (in onCreate)
@Override
public boolean onNavigateUp() {
finish();
return true;
}
@Override
public boolean onSupportNavigateUp() {
finish();
return true;
}