Android Toolbar Back Button

It’s always convenient to have that little button to “go back” to the previous Activity, and to add it is very simple, just add a directive in your“AndroidManifest.xml“.

 

 

  <activity
            android:name=".BackButtonActivity"
            android:parentActivityName=".MainActivity">
            <!-- Este meta dado é necessário para versões abaixo da 4.1 -->
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".MainActivity" />
        </activity>

MainActivity corresponds to the Activity to which the application should return when we click on “return”.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *