Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

minimize application and starts from where user left

i am making an application and i want to minimize the application when user click the minimize button and i am using the below code.below code minimize the Application but when i re open the application it always starts with the first activity.And i want the the application should resume from where the user has minimized the application.. i.e. user minimizes application when he is at 3rd activity and when he re open it the application should start with the 3rd activity not the 1st.

Intent main = new Intent(Intent.ACTION_MAIN);
        main.addCategory(Intent.CATEGORY_HOME);
        main.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(main);
like image 239
MOBEEN Warar Avatar asked Sep 15 '13 19:09

MOBEEN Warar


1 Answers

Instead of your code try using

moveTaskToBack(true);

Read more about this function.

like image 147
MaciejGórski Avatar answered Oct 21 '22 14:10

MaciejGórski