Android Question Sub Main closed on Android 11

ostau

Member
Licensed User
Longtime User
Hi,
I do have an app, which starts another activity from Sub Main. After closing the sub, the program flow returns to Main.Activity_Resume when executed on Android <= 10. But it returns to Main.Activity_Create(false) on Android 11. It seems, on 11 the Activity Main gets destroyed, while on <= 10 it resumes (as desired).
Some facts to know: the app has been developed four years ago, based on Android 6 and has been maintained over the years. We do not use B4XPages

Has anyone an idea to overcome this different behavior?
Kind regars, Oskar
 

agraham

Expert
Licensed User
Longtime User
This behaviour could be expected on earlier versions of Android as well. If Android needs the memory if will destroy activities as required, even if they are on the Activity stack. You need to keep enough state to be able to cope with that. Note that as Main.Activity_Create(false) is called your process still exists and your Process_Globals are intact.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
The only correct solution in this situation is to switch to B4XPages... ? Sorry, someone must have said that ...
It is not the only solution. One can fight with these for sure.
But B4XPages will help a lot if he switch to B4XPages; you are right :cool:
 
Upvote 0

kisoft

Well-Known Member
Licensed User
Longtime User
It is not the only solution. One can fight with these for sure.
But B4XPages will help a lot if he switch to B4XPages; you are right :cool:
Of course you are right ... My previous quote was meant to be humorous, unfortunately my English made this statement flattened ...
 
Upvote 0

ostau

Member
Licensed User
Longtime User
Thanks to all members for their fast replies :) . I was aware, that Android destoys activities, if not enough memory is available. But strange - blieve it or not - my device is an OneNote Plus 8 with 6 GB of RAM, which is used by 40%. On a simple Lenovo-Tab (with Android 6) and 2 GB RAM the app runs as a charme for hours. It also ran on my own device on Android 10 before the update to version 11 was installed. Anyway: it seems I have to brush up the app, because switching to B4XPages seems to be a task for Hercules :-( . I didn't find a simple way to modify the existing app with appropriate efforts.
 
Upvote 0

ostau

Member
Licensed User
Longtime User
Finally I found the reason for the different behaviour: on the phone in the developpers settings the option "Do not store activities" was turned on. So all activities where closed - instead of keeping them in memory till not longer needed or memory runs out :) .
 
Upvote 0
Top