Android Question B4XCanvas become uninitialized if app is put in background

RB Smissaert

Well-Known Member
Licensed User
Longtime User
In a B4XPages project I sometimes run a progressbar by drawing a line on a B4XCanvas that is initialized on a B4XView.
I noticed that when this progressbar is running and I move way from the app and then return to it, the progressbar is not visible anymore.
All else is working fine.
The solution to this seems to be to initialize the B4XCanvas in Sub B4XPage_Appear:

B4X:
Sub Class_Globals
    Private lblPatMap As B4XView
    Private cvsLabelProgress As B4XCanvas
End Sub

Sub Sub B4XPage_Appear
    cvsLabelProgress.Initialize(lblPatMap)
End Sub

Is this the right way?

RBS
 

Cableguy

Expert
Licensed User
Longtime User
Why a canvas? You can achieve the same behaviour with a panel
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Why a canvas? You can achieve the same behaviour with a panel
Just because the label is already there, just in the right place and with the right dimensions. I could add a panel, but it seems to work all fine now.
I have another progressbar, more elaborate, taking up more space, but that wasn't suitable in this case.

RBS
 
Upvote 0
Top