Adding navigation between two activities

We always have different activities in our application and they are not present in home screen , so we have to provide navigation  between our apps , so the user can return to the desired screen.

We need to create a logical pattern in AndroidMainfest.xml file. So to open this file go to app>mainfest>AndroidMainfest.xml , now go to activity tag for

SecondActivity (your secondary activity) and add this code

<activity android:name=".SecondActivity"
          android:parentActivityName=".MainActivity" >
  
    <meta-data
        android:name="android.support.PARENT_ACTIVITY"
        android:value=".MainActivity" />
</activity>

Now Android system will add navigation button automatically in you app.

About kaushal97

Android Enthusiast

Leave a Reply

Your email address will not be published.