Android Question B4XPages pages ids arraylist

ShadTech

Member
Licensed User
thank you Erel fir responding.
i have searched and i found that,

but now creating pages use RAM and crash after many navigations of the app,
(it is WebView in every created page)
,,
Is there a way to destroy prevoisous used pages and clear it from the RAM???
 
Upvote 0

ShadTech

Member
Licensed User
Creating pages doesn't consume memory.

If your app crashes then you should post the error message.
it doesn't crashing just disappear with no message and i need to open it again to run,
i tried to clear used pages from with following code but i doesn't clear it
B4X:
Sub timer2_tick
 
        If GetFreeMem>15000000 Then Root.RemoveAllViews
End Sub
Sub GetFreeMem As Float
    Dim r As Reflector
    Dim MM, TM, FM, Total As Int
    r.Target = r.RunStaticMethod("java.lang.Runtime", "getRuntime", Null, Null)
    MM = r.RunMethod("maxMemory")
    FM = r.RunMethod("freeMemory")
    TM = r.RunMethod("totalMemory")
'    LogColor(MM,Colors.Red)
'    LogColor(FM,Colors.Red)
'    LogColor(TM,Colors.Red)


    Total = MM + FM - TM
    LogColor(TM,Colors.Red)
    Return TM
'    Return Total / 1024
End Sub
 
Last edited:
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
That behavior is expected if you close the only page left on the stack. Might that true in your case?
Set B4XPages.GetManager.LogEvents = True in Initialize to check.
 
Upvote 0
Top