Articles → ANDROID → Back Button In Android

Back Button In Android


  1. MainActivity
  2. SecondActivity

  1. Add a button on MainActivity with the text ‘Navigate’. On click of Navigate button, add the following code
  2. public void Navigate(View view) {
        Intent i = new Intent(getApplicationContext(), SecondActivity.class);

  3. In AndroidManifest.xml, add the following code in SecondActivity
  4. <activity android:name=".SecondActivity" android:parentActivityName=".MainActivity" >
    	<meta-data android:name="" android:value=".MainActivity"></meta-data>

Picture showing the back button in android application
Click to Enlarge

Posted By  -  Karan Gupta
Posted On  -  Thursday, November 28, 2019


Your Email Id  
Query/FeedbackCharacters remaining 250