I am struggling to understand the use of AnimateToBounds and AnimateCamera when using GoogleMapsExtra. As you can see from the code I want to position the map to show the collection of waypoints added, also position the camera centrally in this described area. My (failed) code looks something like this:
The log is not altogether informative:
Unfortunately I can't get past the error line marked. Any advice?
B4X:
Dim LLboundsBuilder1 As LatLngBoundsBuilder
LLboundsBuilder1.Initialize
Dim ThisLL As LatLng
Do While Locations.NextRow
ThisLL.Initialize(Locations.GetDouble("Lat"),Locations.GetDouble("Long"))
gMap.AddMarker3(ThisLL.Latitude,ThisLL.Longitude,Locations.GetString("Name"),bmpMyMarker)
LLboundsBuilder1.Include(ThisLL)
Loop
Dim Bounds As LatLngBounds = LLboundsBuilder1.Build
gmx.AnimateToBounds(gMap,Bounds,5) '<<< Error here
Dim CameraUpdateFactory1 As CameraUpdateFactory
Dim CamUpdate As CameraUpdate
CamUpdate = CameraUpdateFactory1.NewLatLngBounds(Bounds,10 )
gmx.AnimateCamera(gMap,CamUpdate)
The log is not altogether informative:
com.google.maps.api.android.lib6.common.apiexception.c: 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......
Unfortunately I can't get past the error line marked. Any advice?