I have an activity (main) which calls a gps activity (gps), previously when I went from main to gps after gps lost focus the gps activity was black. I changed the code moving the drawing of screen items onto activity_resume. Now the activity re creates the screen objects everytime, which i know is the correct process but not the desired reqiuirement.
What I need is the activity to draw screen objects on activity_create, then on resume to display the screen objects without redrawing/re-initiating everytime.
My code is...
Sub Activity_Create(FirstTime As Boolean)
If FirstTime = True Then
' initialize comments are original code
' FillMenu
' GPSLoading
'PopulateList(0,0,"",0)
'ListAttr.Visible =False
End If
End Sub
Sub Activity_Resume
If MeLat = 0 OR MeLon = 0 Then
If GPSLabel.IsInitialized = False Then
initialize
FillMenu
GPSLoading
If MeGPS.GPSEnabled = False Then
ToastMessageShow("Please enable the GPS device.", True)
StartActivity(MeGPS.LocationSettingsIntent) 'Will open the relevant settings screen.
Else
MeGPS.Start(500, 10) 'Listen to GPS with no filters.
Log("GPS start")
GPSTimer.Enabled=True
End If
Else
GPSTimer.Enabled = False
MeGPS.Stop
GPSTimeOut = 0
End If
Else
ListAttr.Invalidate
End If
End Sub
Is this the correct way or is there a better approach?
What I need is the activity to draw screen objects on activity_create, then on resume to display the screen objects without redrawing/re-initiating everytime.
My code is...
Sub Activity_Create(FirstTime As Boolean)
If FirstTime = True Then
' initialize comments are original code
' FillMenu
' GPSLoading
'PopulateList(0,0,"",0)
'ListAttr.Visible =False
End If
End Sub
Sub Activity_Resume
If MeLat = 0 OR MeLon = 0 Then
If GPSLabel.IsInitialized = False Then
initialize
FillMenu
GPSLoading
If MeGPS.GPSEnabled = False Then
ToastMessageShow("Please enable the GPS device.", True)
StartActivity(MeGPS.LocationSettingsIntent) 'Will open the relevant settings screen.
Else
MeGPS.Start(500, 10) 'Listen to GPS with no filters.
Log("GPS start")
GPSTimer.Enabled=True
End If
Else
GPSTimer.Enabled = False
MeGPS.Stop
GPSTimeOut = 0
End If
Else
ListAttr.Invalidate
End If
End Sub
Is this the correct way or is there a better approach?