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

How to animate marker in android map api V2?

None of versions provided worked for me, so I’ve implemented my custom solution. It provides both – location and rotation animation. /** * Method to animate marker to destination location * @param destination destination location (must contain bearing attribute, to ensure * marker rotation will work correctly) * @param marker marker to be animated */ … Read more

MapView inside a ScrollView?

I have had a same problem for 10 days, but I got a solution a few minutes ago!! Here is the solution. I made a custom MapView and override onTouchEvent() like this. @Override public boolean onTouchEvent(MotionEvent ev) { int action = ev.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: // Disallow ScrollView to intercept touch events. this.getParent().requestDisallowInterceptTouchEvent(true); … Read more

MapView in a Fragment (Honeycomb)

I’ve managed to resolve this by using TabHost in fragment. Here is the idea (briefly): MainFragmentActivity extends FragmentActivity (from support library) and has MapFragment. MyMapActivity extends MapActivity and contain MapView. LocalActivityManagerFragment hosts LocalActivityManager MapFragment extends LocalActivityManagerFragment. And LocalActivityManager contains MyMapActivity activity in it. Example implementation: https://github.com/inazaruk/map-fragment.

Google Maps Android API v2 Authorization failure

Steps: to ensure that device has Google Play services APK to install Google Play Service rev. more than 2 to create project at https://code.google.com/apis/console/ to enable “Google Maps Android API v2” to register of SHA1 in project (NOW, YOU NEED WRITE SHA1;your.app.package.name) at APIs console and get API KEY to copy directory ANDROID_SDK_DIR/extras/google/google_play_services/libproject/google-play-services_lib to root … Read more

Duplicate ID, tag null, or parent id with another fragment for com.google.android.gms.maps.MapFragment

The problem is that what you are trying to do shouldn’t be done. You shouldn’t be inflating fragments inside other fragments. From Android’s documentation: Note: You cannot inflate a layout into a fragment when that layout includes a <fragment>. Nested fragments are only supported when added to a fragment dynamically. While you may be able … Read more