In many apps (Calendar, Drive, Play Store) when you tap a button and enter a new activity, the icon in the title bar turns into a back button, but for the app I am making, i
use this code
@Override public void onCreate(Bundle savedInstanceState) { ... getActionBar().setDisplayHomeAsUpEnabled(true); }
after that write this code in onOptionsItemSelected method
onOptionsItemSelected
int id = item.getItemId(); if (id==android.R.id.home) { finish(); }