ValDog Active Member Licensed User Longtime User Jul 21, 2014 #1 Is there a way to detect, programatically, whether an app is still in memory? I find that if my app crashes it sometimes stays in memory - which complicates things when I run it again.
Is there a way to detect, programatically, whether an app is still in memory? I find that if my app crashes it sometimes stays in memory - which complicates things when I run it again.
Douglas Farias Expert Licensed User Longtime User Jul 21, 2014 #2 this is a bigproblem on b4a i m trying to understand this too =( if i use firsttime to run layouts i cant close the current activity with activity.finish and if i need reopen the closed activity i have layout not initializated if i dont use firsttime the layout stay on the activity i can use activity.finish too but when i open this 2 x have memory error *-* Upvote 0
this is a bigproblem on b4a i m trying to understand this too =( if i use firsttime to run layouts i cant close the current activity with activity.finish and if i need reopen the closed activity i have layout not initializated if i dont use firsttime the layout stay on the activity i can use activity.finish too but when i open this 2 x have memory error *-*
NJDude Expert Licensed User Longtime User Jul 21, 2014 #3 this is a bigproblem on b4a i m trying to understand this too =( Click to expand... That has nothing to do with B4A, that's how Android works. if i use firsttime to run layouts i cant close the current activity with activity.finish and if i need reopen the closed activity i have layout not initializated Click to expand... You are doing it wrong, you should NOT load layouts in FirstTime, that only triggers when the app runs for the VERY FIRST TIME. Upvote 0
this is a bigproblem on b4a i m trying to understand this too =( Click to expand... That has nothing to do with B4A, that's how Android works. if i use firsttime to run layouts i cant close the current activity with activity.finish and if i need reopen the closed activity i have layout not initializated Click to expand... You are doing it wrong, you should NOT load layouts in FirstTime, that only triggers when the app runs for the VERY FIRST TIME.
Douglas Farias Expert Licensed User Longtime User Jul 21, 2014 #4 You are doing it wrong, you should NOT load layouts in FirstTime, that only triggers when the app runs for the VERY FIRST TIME. Click to expand... if i dont use i cant load my activity again because go load my layout again and again and this give me memory error *-* Upvote 0
You are doing it wrong, you should NOT load layouts in FirstTime, that only triggers when the app runs for the VERY FIRST TIME. Click to expand... if i dont use i cant load my activity again because go load my layout again and again and this give me memory error *-*
NJDude Expert Licensed User Longtime User Jul 21, 2014 #5 Then check your code, because that's how it's supposed to be done. Upvote 0
Douglas Farias Expert Licensed User Longtime User Jul 21, 2014 #6 You are doing it wrong, you should NOT load layouts in FirstTime, that only triggers when the app runs for the VERY FIRST TIME. Click to expand... 1 exemple make a main activity make a login activity make a register activity and make a principal activity OK TOTAL 4 LAYOUTS now you open the app(main), click at register and open register activity. ok later your register done go to principal and close the current activity (register). now you is on the principal activity and you want make a logoff and register another account. you close the principal activity and open register again. = Memory error because you is loading layout again if you use first time here you have layout not initializated if you dont use have memory error Last edited: Jul 21, 2014 Upvote 0
You are doing it wrong, you should NOT load layouts in FirstTime, that only triggers when the app runs for the VERY FIRST TIME. Click to expand... 1 exemple make a main activity make a login activity make a register activity and make a principal activity OK TOTAL 4 LAYOUTS now you open the app(main), click at register and open register activity. ok later your register done go to principal and close the current activity (register). now you is on the principal activity and you want make a logoff and register another account. you close the principal activity and open register again. = Memory error because you is loading layout again if you use first time here you have layout not initializated if you dont use have memory error
NJDude Expert Licensed User Longtime User Jul 21, 2014 #7 Let me say it again: Then check your code. Upvote 0
Douglas Farias Expert Licensed User Longtime User Jul 21, 2014 #8 Let me say it again: Then check your code. Click to expand... yes i already see your post http://www.b4x.com/android/forum/threads/app-still-in-memory.43087/#post-261424 lol you have posted in the same time of me =) Upvote 0
Let me say it again: Then check your code. Click to expand... yes i already see your post http://www.b4x.com/android/forum/threads/app-still-in-memory.43087/#post-261424 lol you have posted in the same time of me =)
thedesolatesoul Expert Licensed User Longtime User Jul 21, 2014 #9 ValDog said: Is there a way to detect, programatically, whether an app is still in memory? I find that if my app crashes it sometimes stays in memory - which complicates things when I run it again. Click to expand... Does your app crash or does your activity crash? Upvote 0
ValDog said: Is there a way to detect, programatically, whether an app is still in memory? I find that if my app crashes it sometimes stays in memory - which complicates things when I run it again. Click to expand... Does your app crash or does your activity crash?
thedesolatesoul Expert Licensed User Longtime User Jul 21, 2014 #10 Douglas Farias said: if i dont use i cant load my activity again because go load my layout again and again and this give me memory error *-* Click to expand... Always load layout in activity_create (not first time, not resume) If the activity is loaded again, activity_Create will not run if it is already in memory. If it is not in memory it will run, but then the memory is empty anyway. Upvote 0
Douglas Farias said: if i dont use i cant load my activity again because go load my layout again and again and this give me memory error *-* Click to expand... Always load layout in activity_create (not first time, not resume) If the activity is loaded again, activity_Create will not run if it is already in memory. If it is not in memory it will run, but then the memory is empty anyway.
Douglas Farias Expert Licensed User Longtime User Jul 22, 2014 #11 Always load layout in activity_create (not first time, not resume) If the activity is loaded again, activity_Create will not run if it is already in memory. If it is not in memory it will run, but then the memory is empty anyway. Click to expand... not realy look this sample i make here, run this 8 or 10x for u see http://www.b4x.com/android/forum/th...ck-of-memory-with-video-and-sample-app.43097/ Upvote 0
Always load layout in activity_create (not first time, not resume) If the activity is loaded again, activity_Create will not run if it is already in memory. If it is not in memory it will run, but then the memory is empty anyway. Click to expand... not realy look this sample i make here, run this 8 or 10x for u see http://www.b4x.com/android/forum/th...ck-of-memory-with-video-and-sample-app.43097/
M Mrjoey Active Member Licensed User Longtime User Jul 22, 2014 #12 dont debug in rapid mode , debug in legacy mode Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jul 22, 2014 #13 Please don't make duplicate posts. See my answer there. Upvote 0