Google Maps API v2: LatLngBounds from CameraPosition

You can’t get the LatLngBounds from the CameraPosition, but you can get them easily from the GoogleMap. private GoogleMap mMap; mMap.setOnCameraChangeListener(new OnCameraChangeListener() { @Override public void onCameraChange(CameraPosition position) { LatLngBounds bounds = mMap.getProjection().getVisibleRegion().latLngBounds; fetchData(bounds); } });

How to center the camera so that marker is at the bottom of screen? (Google map api V2 Android)

I might edit this answer later to provide some code, but what I think could work is this: Get LatLng (LatLng M) of the clicked marker. Convert LatLng M to a Point (Point M) using the Projection.toScreenLocation(LatLng) method. This gives you the location of the marker on the device’s display (in pixels). Compute the location … Read more

Moving MapFragment (SurfaceView) causes black background flickering

Of course the proper solution will be for Google to fix the problem (see Android Maps V2 issue 4639: http://code.google.com/p/gmaps-api-issues/issues/detail?id=4639). However, one of my coworkers suggested simply extending the map beyond its container. If we extend the map fragment beyond the visible region of its container, like so: android:layout_marginLeft=”-40dp” android:layout_marginRight=”-40dp” we can reduce/eliminate the flickering. … Read more

tech