I have a application that has two activities
- Activity1
- Activity2
Now i start Activity1
and move to Activity2
now i want to close the application at a moment
- If i use
finish()
i am able to close onlyActivity2
and notActivity1
What i want to do ::
- i want my application to quit(close all activities and go to homescreen)
- But i don't want my apk to be removed from android system itself
- How can i achieve this ?
{Edit}
- I used the code(Activity2 has a fragment which launched a dialog on "ok" condition in positive condition i am performing this condition below)
- I am able to launch the previous activity but it is not canceled, its just reloaded
Intent intent = new Intent(getActivity(), SplashActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
getActivity().finish();