Well updating the AnimateToBounds method so that it (automatically) handles cases where the GoogleMap has no layout has proved pretty much impossible.
There's no way to get the required reference to the View that holds all elements of the map, and without that reference there's no way to attach a listener to the View.
So no way to listen until the View has layout before calling AnimateToBounds.
The other solution suggested is to pass the map width and height to the method instead of presuming that the method can get the map width and height.
So this is the existing AnimateToBounds (java) method:
public static void AnimateToBounds(GoogleMap GoogleMap1, com.google.android.gms.maps.model.LatLngBounds LatLngBounds1, int Padding){
GoogleMap1.animateCamera(CameraUpdateFactory.newLatLngBounds(LatLngBounds1, Padding));
}
And a new AnimateToBounds2 method passes the map width and height:
public static void AnimateToBounds2(GoogleMap GoogleMap1, com.google.android.gms.maps.model.LatLngBounds LatLngBounds1, int Width, int Height, int Padding){
GoogleMap1.animateCamera(CameraUpdateFactory.newLatLngBounds(LatLngBounds1, Width, Height, Padding));
}
AnimateToBounds would be used when you are sure that the map has layout, otherwise AnimateToBounds2 would be used.
I've recompiled GoogleMapsExtras with the new method, can you give it a try?
I've also added another new (unrelated) method:
Takes a snapshot of the map.
On completion raises the event SnapshotReady(Bitmap1 As Bitmap).
Snapshot(GoogleMap1 As GoogleMap, EventName As String)
I've not yet tested this new Snapshot method, there were a few posts on the forum a month or so back where members were trying to capture the map view, hopefully this new method will work as desired...
Martin.
[edit]I've now uploaded the update as an official update, version 1.35 of GoogleMapsExtras is attached to the first post in this thread.[/edit]