Android Question Object shoul first be initialized

zingo

Member
Licensed User
I have been a registered user for long time. Now I upgraded to version 10.2 (licenced user disappeared).
Anyway, I'm testing the new GoogleMaps Api and get this error:
Error occurred on line: 35 (Main)
java.lang.RuntimeException: Object should first be initialized (LatLng).

Here's the routine, slightly modified to test CameraAnimate

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
Wait For MapFragment1_Ready
gmap = MapFragment1.GetMap
gmap.MapType=1
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then
gmap.MyLocationEnabled = True

Dim Cpos As CameraPosition
Cpos.Initialize(gmap.MyLocation.Latitude,gmap.MyLocation.Longitude, 17)

Log("LAT --> " & gmap.MyLocation.Latitude)
Log("LON --> " & gmap.MyLocation.Longitude)

gmap.AnimateCamera(Cpos)

Else
Log("Autorizzazione negata!")
End If
End Sub

Connecting to the device, CameraAnimate still works disregarding of the error.
Creating a realease app just crashes...
Any suggestions?
 

derez

Expert
Licensed User
Your post is a question, not a code snippet.
Also, please use insert (...) code to put your posted code.
 

zingo

Member
Licensed User
Sorry for the mistake and the the wrong place: I usually use this forum only to read, I rarely post.
(Should I repost this in the right section?)
And thanx, now my icon has changed to registered user again.
Anyway, in debug the GPS starts correctly ang gets the right position, even if the log window shows the error.
 

drgottjr

Well-Known Member
Licensed User
java.lang.RuntimeException: Object should first be initialized (LatLng).
may we see where this occurs? Cpos is something else.
 
Top