Problem accessing variables

Smee

Well-Known Member
Licensed User
Longtime User
I have a variable in the main activity called PageNumber. In a secondary activity i save the current page thus

B4X:
Sub Activity_Pause (UserClosed As Boolean)
   Main.PageNumber= PageTurner.CurrentPage
   Main.CatNum=CatNum
   PageTurner.OnPause
End Sub

Sub Activity_Resume
   Log (Main.PageNumber)
   Log(Main.CatNum)
   PageNumber=Main.PageNumber
   CatNum=Main.CatNum
   PageTurner.CurrentPage = PageNumber
   PageTurner.OnResume
End Sub

when resuming the activity from the main module usng StartActivity the variables are Zero. They are Dim in Process_Globals.

Where am i going wrong
 

Smee

Well-Known Member
Licensed User
Longtime User
This is the unfiltered log. As can be seen it looks like the process has died

B4X:
CTRL-EVENT-SCAN-RESULTS  Ready
GC_EXTERNAL_ALLOC freed 362 objects / 35256 bytes in 25ms
Displayed activity WDROrder.Program/.catalogues: 1895 ms (total 1895 ms)
GC_EXPLICIT freed 46 objects / 2144 bytes in 15ms
GC_FOR_MALLOC freed 5279 objects / 537400 bytes in 17ms
GC_EXPLICIT freed 91 objects / 4920 bytes in 16ms
GC_EXPLICIT freed 2836 objects / 176752 bytes in 32ms
GC_EXTERNAL_ALLOC freed 397 objects / 13016 bytes in 25ms
1/70 /cats/baby/BABY 124.jpg
GC_EXTERNAL_ALLOC freed 109 objects / 24912 bytes in 25ms
GC_EXTERNAL_ALLOC freed 620 objects / 17864 bytes in 26ms
2/70 /cats/baby/BABY 140.jpg
GC_EXTERNAL_ALLOC freed 54 objects / 22744 bytes in 25ms
SET_ACTIVE arg1=0 arg2=0 obj=null
** Activity (catalogues) Pause, UserClosed = true **
Main.PageNumber = 2
Main.CatNum = 0
Process WDROrder.Program (pid 6233) has died.
WIN DEATH: Window{ae4282b8 WDROrder.Program/WDROrder.Program.main paused=false}
WIN DEATH: Window{ae4f1b38 WDROrder.Program/WDROrder.Program.catalogues paused=true}
WIN DEATH: Window{ae4f6e60 SurfaceView paused=false}
WIN DEATH: Window{ae520308 AtchDlg:WDROrder.Program/WDROrder.Program.catalogues paused=false}
Start proc WDROrder.Program for activity WDROrder.Program/.main: pid=6271 uid=10043 gids={3003, 1015}
Process 6233 terminated by signal (11)
Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@ae4753d8 (uid=10043 pid=6271)
Client not active, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@ae41d9c0
GC_FOR_MALLOC freed 23780 objects / 447768 bytes in 18ms
GC_FOR_MALLOC freed 34677 objects / 561072 bytes in 20ms
** Activity (main) Create, isFirst = true **
Yes
GC_FOR_MALLOC freed 21632 objects / 432088 bytes in 19ms
** Activity (main) Resume **
0
Displayed activity WDROrder.Program/.main: 1304 ms (total 1304 ms)
stopSharedTimer removing all timers
BrowserFrame constructor: this=Handler{ae3520e0}
WEBCORE_INITIALIZED_MSG_ID
ACTION_BATTERY_CHANGED pluggedType: 0

It dies straight after the main module has had its number updated
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
Couldn't you post your project as a zip file or at least a smaller project that shows your problem.
It would be much easier to help you.

Best regards.

Hi Klaus,

I can post the entire code of both activities would this help?

in the meantime i will try to write a sample which uses only a few files. the db will have to be created dynamicaly then
 
Last edited:
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
The OS is allowed to kill your process. You should be prepared for this by saving the state to a file.

Some task managers kill processes as soon as they can.

Ok , What is the best way to do this?

ooops sorry, just re-read the thread. State Manager!!

Thanks
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…