android-maps
Using Google Places API
Some points to keep in mind: In order to use Google’s Places API, you will need to register and obtain a Google Map’s API Key. In class UrlSigner in the tutorial the variable descriptions are: keyString => is your Google Map api key. urlString is the url you want to sign using the api key. … Read more
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); } });
Android: Setting Zoom Level in Google Maps to include all Marker points
Yet another approach with Android Map API v2: private void fixZoom() { List<LatLng> points = route.getPoints(); // route is instance of PolylineOptions LatLngBounds.Builder bc = new LatLngBounds.Builder(); for (LatLng item : points) { bc.include(item); } map.moveCamera(CameraUpdateFactory.newLatLngBounds(bc.build(), 50)); }
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