Finish all activities in Basic4Android
-
28-10-2019 - |
Question
I have an application with many activities, sharing the same Menu, which is created in a code module. This Menu has an option "Exit". How do I finish all running activities without using ExitApplication? Do I have to create a variable in the code module (ExitNow as boolean) and check it in every Activity_Resume of every activity?
Solution
put activity.finish as the code for your exit button
OTHER TIPS
try this one.
Intent intent = new Intent(getApplicationContext(), Home.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
type this in prossec global :
Dim GExit as boolean
Gexit= false
type in all resume in all activity this code:
if Gexit = true then activity.finish
and type this code in your BTNEXIT:
Gexit= true
activity.finish
I tried a lot of examples but this really worked for me
Intent intent = new Intent(getApplicationContext(), HomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow