Minimize the application and start from where the user is

I am making an application and I want to minimize the application when the user clicks the Minimize button and I use the code below. Below code minimizes the application, but when I open the application, it always starts with the first action. I want the application to resume from where the user minimized the application. That is, the user minimizes the application when he is in the 3rd lesson, and when he opens it, the application should begin with the 3rd action, and not the first.

Intent main = new Intent(Intent.ACTION_MAIN); main.addCategory(Intent.CATEGORY_HOME); main.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(main); 
+4
source share
1 answer

Instead of code, try using

 moveTaskToBack(true); 

Learn more about this feature .

+17
source

Source: https://habr.com/ru/post/1502301/


All Articles