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:
Here is one more thing to check for in case the other answers here (or here or here or here) don't work.
I had copied some code from another activity that disabled the menu. Deleting this method (and applying the solutions given in the others answers) allowed the up button to work.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// hide the menu
return false;
}