Android Question Google maps question

kohle

Active Member
Licensed User
Longtime User
Hi,
I get an error message when I use googleMapsExtras to show a mapp with 2 points.
This error only is triggered, when I close the app with the back key and open it again over the task manager.

Error:
java.lang.IllegalStateException: Error using newLatLngBounds(LatLngBounds, int): Map size can't be 0. Most likely, layout has not yet occured for the map view. Either wait until layout has occurred or use newLatLngBounds(LatLngBounds, int, int, int) which allows you to specify the map's dimensions.

The code is in the map_ready

Using this Code:

If GL_m_lati=0 Or GL_m_longi=0 Or GL_my_lat=0 Or GL_my_longi=0 Then Return

Dim CameraUpdateFactory1 As CameraUpdateFactory
Dim CameraUpdate1 As CameraUpdate
Dim llbounds As LatLngBounds
Dim sw, ne As LatLng

ne.Initialize(GL_m_lati,GL_m_longi)
sw.Initialize(GL_my_lat,GL_my_longi)

If GL_my_lat>GL_m_lati Then
llbounds.Initialize(ne, sw)
Else
llbounds.Initialize(sw, ne)
End If

CameraUpdate1=CameraUpdateFactory1.NewLatLngBounds(llbounds,300)

If CameraUpdate1.IsInitialized=True And gmap.IsInitialized=True Then
GoogleMapsExtras1.MoveCamera(gmap, CameraUpdate1)
End If


This code works fine :

Dim cp As CameraPosition
cp.Initialize(GL_m_lati,GL_m_longi, 15)
gmap.AnimateCamera(cp)
 
Top