Activity_Pause/Resume events not firing?

kanaida

Active Member
Licensed User
Longtime User
I'm not sure if i'm just not understanding something here but i'm just trying to do something simple. Store the scroll position of a list on Pause() and restore it on Resume() so that orientation changes etc.. don't reset it to position 0.

However when i look at the logs i see this:
[Common.java:151:Log()] ** Activity (main) Pause, UserClosed = false **
[Common.java:151:Log()] ** Activity (main) Create, isFirst = false **
[Common.java:151:Log()] ** Activity (main) Resume **

but I set breakpoints on:

B4X:
Sub Activity_Resume
sv.ScrollPosition = LastScrollPosition
End Sub

Sub Activity_Pause (UserClosed As Boolean)
LastScrollPosition = sv.ScrollPosition
End Sub

The breakpoints never hit, the code isn't run at all. I'm running it in debug mode, not sure where i'm going wrong here...
 

Ricky D

Well-Known Member
Licensed User
Longtime User
I use StateManager to keep track of variables when my activities are paused/restarted. It works perfectly.

Regards, Ricky
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
If it is just to ensure the scroll position is maintained when the device orientation changes then what you are doing is correct, as long as LastScrollPosition is a Global variable.
 
Upvote 0

kanaida

Active Member
Licensed User
Longtime User
Thanks.

I stored it as a Process_Global. That should stay there as long as the app isn't killed.

I just loaded a bunch of thumbnails, saved em in a process_global along with the scroll position so that on activity create I don't reload everything unless I trigger it with a refresh button.
 
Upvote 0
Top