App restarts from scratch and does not leave me in the last Open Activity


I am programming an application in Android Studio , but I have encountered a problem:

  • I enter my Application and launch the main activity.
  • I press a button that launches me into a second activity.
  • I press the Home button and then return to my application.
  • When performing these steps, when you reopen the application, it does not remain in the last open activity. the Application restarts from scratch.

    Does anyone know what I can do to keep the latest state of my application? That is, do not restart from scratch when I minimize it.

    asked by Gustavo 10.05.2016 в 19:28

    1 answer


    What you are asking is:


    because it does not start in the last Activity open when you close your   application?

    Necessarily your application has one of its activities configured to be the starting point of your application, which you can see within your AndroidManifest.xml :

            android:label="Mi App">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
    answered by 10.05.2016 в 21:52