How can I program the back button on the action bar to go back to the previous activity?
<p>I want to know how I can program the back button in the action bar to revert back to the previous activity and finish the activity that was just shown?</p>

<p>About.class</p>

<pre><code>public class About extends FragmentActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.about);
        getActionBar().setDisplayHomeAsUpEnabled(true);
// Get tracker.
        Tracker t = ((AnalyticsTracker) getApplication()).getTracker(AnalyticsTracker.TrackerName.APP_TRACKER);

// Enable Display Features so you can see demographics in Google Analytics
        t.enableAdvertisingIdCollection(true);

// Set screen name.
        t.setScreenName("About");

// Send a screen view.
        t.send(new HitBuilders.AppViewBuilder().build());
        FragmentManager fragmentManager = getFragmentManager();
        android.app.FragmentTransaction fragmentTransaction =
                fragmentManager.beginTransaction();

        adView ls_fragment = new adView();
        fragmentTransaction.replace(android.R.id.content, ls_fragment);

        AdView mAdView = (AdView) findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest.Builder().build();
        mAdView.loadAd(adRequest);

    }

}
</code></pre>

<p>The layout for the about page.
about.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
    &lt;RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id = "@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/black"
        &gt;


    &lt;RelativeLayout
            android:background="@mipmap/home"
            android:layout_width="match_parent"
            android:layout_height="match_parent"&gt;

            &lt;ImageView
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:id="@+id/imageView"
                android:background="@mipmap/ic_launcher"
                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true" /&gt;

        &lt;TextView
            android:layout_width="300dp"
            android:layout_height="250dp"
            android:id="@+id/textView9"
            android:gravity="center"
            android:textSize="16dp"
            android:text="@string/aboutText"
            android:background="@drawable/text"
            android:layout_below="@+id/imageView"
            android:layout_centerHorizontal="true" /&gt;

        &lt;fragment
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:name="course.labs.converjz.adView"
            android:id="@+id/fragment"
            tools:layout="@layout/adview"
            android:layout_gravity="center|bottom"
            android:layout_alignWithParentIfMissing="false"
            android:layout_alignParentBottom="true"
            android:layout_alignParentStart="true" /&gt;

    &lt;/RelativeLayout&gt;
&lt;/RelativeLayout&gt;
</code></pre>

<p>The specific style which creates the actionbar and adds the back button to it.
Styles.xml</p>

<pre><code> &lt;style name= "MenuBar" parent="@style/AppBaseTheme"&gt;
        &lt;item name = "android:homeAsUpIndicator"&gt;@mipmap/back&lt;/item&gt;

&lt;/style&gt;
</code></pre>

<p>The back button image is in the mipmap icon folder.</p>