How to create a New Android Activity with Up Navigation

  1. Create a New Blank Activity

  2. Create a Link to the New Activity

public void gotoNewActivity(View v){ Intent intent = new Intent(this.NewActivity.class); startActivity(intent); }

  1. Add a click Listener to the button/menu item to run the gotoNewActivity or add the onCLick in the xml layout:

``` xml (activity_main.xml):


Listener (

Button button= (Button) findViewById(; button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { gotoNewActivity(); } }); ```

  1. CreateUp Navigation
  • Make the Activity a Child of Main:


<Activity .... <meta-data android:name="" android:value="com.example.myApp.MainActivity" />

  • Add UpAction

** :**


  • Handle the Click OnOptionsItemSelected…:

NavUtils.navigateUpFromSameTask(this); return true;

Note: Activity must extend from Activity and not ActionBarActivity* Source