The tech advice is to let the OS kill them at its own convenience! but the problem is when I run the same app again,
it started from where it last closed, not from Main activity. and there's a lot of data in memory too.
If you have service modules you can use stopservice(name)
I am trying to understand why have multiple Activities - I just use panels and make them visible or not visible as required or zoom them down to .setlayout(0,0,1,1)
You are right, if I use only one activity then there is no problem.. the problem is when I use more than activity, and this is very normal in large business apps.
Thanks anyways.
Question still on...
If you have service modules you can use stopservice(name)
I am trying to understand why have multiple Activities - I just use panels and make them visible or not visible as required or zoom them down to .setlayout(0,0,1,1)
Thanks KZero, but the manifest line didn't change it..
If all activities are finished then the app will start from main next time.. but the question is how to finish all the activities?
If you have service modules you can use stopservice(name)
I am trying to understand why have multiple Activities - I just use panels and make them visible or not visible as required or zoom them down to .setlayout(0,0,1,1)
You can load them and unload them as needed to conserve resources, and keep as much code as possible in classes. That way, you can get "best of both worlds", you get the simplicity of a single activity without the overhead of a single activity.
Thanks KZero, but the manifest line didn't change it..
If all activities are finished then the app will start from main next time.. but the question is how to finish all the activities?
'code by JakeBullet70
Sub RestartApp
Dim R, R2 As Reflector
R.Target = R.GetActivity
R.Target = R.RunMethod("getApplicationContext")
R2.Target = R.RunMethod("getPackageManager")
Dim I As Intent
I = R2.RunMethod2("getLaunchIntentForPackage", R.RunMethod("getPackageName"), "java.lang.String" )
R.Target = I
R.RunMethod2("addFlags", 67108864, "java.lang.int")
StartActivity(I)
End Sub
this code will close all activities and restart the app
you can use it in Activity_Resume after checking if the app need to be restarted
Thanks KZero for your efforts..
(Activity_Resume ) of each activity? I have 5 activities in my project.
Also I don't want to restart the app. but when I restart it (anytime later) must restart from Main
Thanks KZero for your efforts..
(Activity_Resume ) of each activity? I have 5 activities in my project.
Also I don't want to restart the app. but when I restart it (anytime later) must restart from Main
Sub btnExit
CodeModule.aExit=True
Activity.Finish
End sib
one more question: Where will this aExit variable live? will it still be alive after the activity is killed? or should I store it somewhere in
text file or SQLite database
Sub btnExit
CodeModule.aExit=True
Activity.Finish
End sib
one more question: Where will this aExit variable live? will it still be alive after the activity is killed? or should I store it somewhere in
text file or SQLite database
it will be alive if the process still cached in memory, and if not the application will start normally because its already finished and its memory cleared
it will be alive if the process still cached in memory, and if not the application will start normally because its already finished and its memory cleared
Well, I can pray for the process to live long, but you can't guarantee because on exit you only finished one activity, not all.. and your code depends on the life of the aExit variable.
Well, I can pray for the process to live long, but you can't guarantee because on exit you only finished one activity, not all.. and your code depends on the life of the aExit variable.