Android Basics - How to show back button on an Activity?

You should have at-least two activities.

  • Parent activity from which another activity is getting displayed.
  • Another activity which is shown from parent activity.


  • Login activity = Parent activity = LoginActivity
  • Forgot Password activity = Child activity = ForgotPasswordActivity

How to set up?

  1. Open AndroidManifest.xml
  2. Locate child activity, in my case it is ForgotPasswordActivity & replace it as follows.
<activity android:name=".LoginActivity" />

<activity android:name=".ForgotPasswordActivity">
        android:value=".LoginActivity" />

Demo Output for Android