with the help of these Android Docs.I am trying to do a action bar Back button.I get an Action Bar Back Button like these below image:
Try like
First of all you need to use addToBackStack() before commit() for Fragments
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
// Respond to the action bar's Up/Home button
case android.R.id.home:
if(getSupportFragmentManager().getBackStackEntryCount()>0)
getSupportFragmentManager().popBackStack();
return true;
}
return super.onOptionsItemSelected(item);
}