Hi everyone,
How big is the amount of data we can temporarily save inside Process_Globals block ? Is there a recommended amount an application should keep there? For example , I need to save around 100kB worth of variable values (when the activity gets paused) so that I can replicate my screen later on .Is this value reasonable? Or can I temporarily save there say, around 200kB or even more without worrying about system crash? In conventional OS, this would not be a problem because the OS's virtual memory manager will cache it in the secondary storage.
And here's a follow up : I have created a class but it seems , it cannot access the Process_Globals variables although I don't get any warning or error from the IDE. The test consists of a button created in a class and viewed in the main activity. The activity has a timer that ticks every 500ms and monitors a boolean variable in the Process_Globals and responds accordingly when the variable is true. Here, when I click the button nothing happens but I monitored that the timer is ticking. Here's the code:
Main Module:
B4X:
Sub Process_Globals
Dim monitor As Boolean
Dim tmr As Timer
End Sub
Sub Globals
Dim bClass As myclass
End Sub
Sub Activity_Create(FirstTime As Boolean)
tmr.Initialize("tmr",500)
tmr.Enabled = True
bClass.Initialize("")
Activity.AddView(bClass.View,40%x,40%y,20%x,20%y)
End Sub
Sub tmr_tick
Log("Tick!") ' it is indeed ticking!
If monitor Then ' this section is not executed
Log("Caught")
ToastMessageShow("Clicked",False)
monitor = False
End If
End Sub
My Class :
B4X:
Sub Class_Globals
Private btn As Button
End Sub
Public Sub Initialize(objName As String)
btn.Initialize("btn")
End Sub
Sub getView As View
Return btn
End Sub
Sub btn_click
monitor = True 'let's change the state of a var in Process_Globals
End Sub
Quick reply from the community ,as usual.
Muchas Gracias! HotShoe . I suppose the same scope resolution applies to classes? Oops, I realized, the Private and Public directives would take care of it.