Note: This seems to be more of a problem with the hardware (mobile device) than B4A (I suspect).
Hardware: Samsung Active 8 Tablet, RAM vehicle powered cradle.
This device maintains battery charge thru the "pogo" pins of the device and cradle.
The problem is: When the device is removed from the cradle (loses power), it causes the activity to Pause and Create...
** Activity (act_drvscreen) Pause, UserClosed = false **
** Activity (act_drvscreen) Create, isFirst = false **
When this happens, the activity form goes completely black (it's default background color) and then shows the elements on the form again.
This is quite annoying for the users when the device is constantly making and breaking the power connection while driving down the road (vibration), particularly at night when it acts as a strobe light distraction...
In the sample below, one will note a view that is added in code (compass). This view WILL NOT disappear during the make / break power cycle - where ANY and ALL that were added with the designer will. Hence the strange behaviour with Activity.LoadLayout.... (where all views are re-initialized upon load).
The weird thing is, if one uses the mini-USB cable to power the device, pulling in and out of the port (make / break charge) does not cause the same action (NO pause / create).
Everything is stable as expected - since charging a device should have nothing to do with a foreground running app (one would assume).
I guess, my only resolve it to create all of this forms views in code - and hope for the best... Defeats the purpose of the designer however.
Thanks
Hardware: Samsung Active 8 Tablet, RAM vehicle powered cradle.
This device maintains battery charge thru the "pogo" pins of the device and cradle.
The problem is: When the device is removed from the cradle (loses power), it causes the activity to Pause and Create...
** Activity (act_drvscreen) Pause, UserClosed = false **
** Activity (act_drvscreen) Create, isFirst = false **
When this happens, the activity form goes completely black (it's default background color) and then shows the elements on the form again.
This is quite annoying for the users when the device is constantly making and breaking the power connection while driving down the road (vibration), particularly at night when it acts as a strobe light distraction...
In the sample below, one will note a view that is added in code (compass). This view WILL NOT disappear during the make / break power cycle - where ANY and ALL that were added with the designer will. Hence the strange behaviour with Activity.LoadLayout.... (where all views are re-initialized upon load).
The weird thing is, if one uses the mini-USB cable to power the device, pulling in and out of the port (make / break charge) does not cause the same action (NO pause / create).
Everything is stable as expected - since charging a device should have nothing to do with a foreground running app (one would assume).
I guess, my only resolve it to create all of this forms views in code - and hope for the best... Defeats the purpose of the designer however.
Thanks
B4X:
Sub Activity_Create(FirstTime As Boolean)
Main.MyMainName = "MainForm"
camready = False
gracecnt = 0
bu.Initialize
Log(" First time drvscrn: "&FirstTime)
Activity.LoadLayout( "drvscrn") ' all elements disappear - then reappear with make / break power from cradle...
spdcolor = lblspd.TextColor
cornerclr = lbldate.TextColor
distclr = lblodom.TextColor
bv1.Visible = False
'If FirstTime Then
ispd = 0
tick.Initialize("tic",1000)
DefCM.CurrOdom = DefCM.GetLastOdom
lastloc = DefCM.CurrLoc
StartDriveRecord
'End If
Compass1.Initialize( "lbltouch_Click") ' this view will not disappear - always shows on the form.... (manually added here)
Activity.AddView(Compass1, 30%x, 2.4%y, 40%x, 13.1%y)
Compass1.CompassLineColor = Colors.DarkGray 'Green
Compass1.CompassBackgroundColor = Colors.Black 'DarkGray
Compass1.CompassMarkerColor = Colors.Cyan
Compass1.CompassRangeDegrees = 360
Compass1.CompassShowMarker = True
Compass1.CompassTextColor = Colors.Yellow
Compass1.CompassTextSize = 38
' Log(" Recreated Activity Drive Screen: "&FirstTime)
lblspd.TextSize = BDmod.SetTextSize( lblspd,lblspd.Text,99.0)
If CMT.IsInitialized = False Then
CMT.Initialize(Activity, Me, Activity.Height,Activity.Width)
End If
End Sub