How to Add an Up Button to the AppBar - Android Studio Tutorial



Open Mainfest.xml
Add the line android:parentActivityName=".MainActivity" in your activity from where u want to go back to mainactivity
If you want to go back to another activity then change main_activity to that activity name.



<manifest  ...
   package="com.myApp.example" > 

   ...
        <activity
            android:name="com.myApp.example.AboutUsActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/AboutUs" 
            android:parentActivityName="com.myApp.example.MainActivity" >
</activity> ... </manifest>

No comments:

Post a Comment

Pages