I have developed an android application. According to requirement, data should only be fetched once from server in all activities and activity state should be save, so when user out of that screen and landed to that activity again it will see same preview again as it has left. I have achieved this with following attributes in Activity tag.
android:launchMode="singleInstance"
android:alwaysRetainTaskState="true"
Now Problem is that every activity is creating its instance. i want user to get out of application when user press Back button. i Am Overiding my back button with home button. here is the code i am using.
Intent intent = new Intent();
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
startActivity(intent);
But when user click again app icon application open opening again from the screen which was left previewed rather than starting from launching screen. what is the best solution to close application in my case and start from launching activity again. please help me. i need help. Thanks in Advance.