Creating Custom Overlay on the map

Okay, I tried to do things on my Own, and put this code to get the above effect: public class MarkerOverlay extends Overlay { Geocoder geoCoder = null; public MarkerOverlay() { super(); } @Override public boolean onTap(GeoPoint geoPoint, MapView mapView){ selectedLatitude = geoPoint.getLatitudeE6(); selectedLongitude = geoPoint.getLongitudeE6(); return super.onTap(geoPoint,mapView); } @Override public void draw(Canvas canvas, MapView … Read more

Google map for android my location custom button

See below xml file to custom button: <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” > <fragment android:id=”@+id/maps” android:name=”pl.mg6.android.maps.extensions.SupportMapFragment” android:layout_width=”match_parent” android:layout_height=”match_parent” /> <LinearLayout android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_marginLeft=”10dp” android:layout_marginRight=”10dp” android:layout_marginTop=”5dp” > <ImageView android:id=”@+id/imgMyLocation” android:layout_width=”40dp” android:layout_height=”40dp” android:scaleType=”fitXY” android:src=”https://stackoverflow.com/questions/23883235/@drawable/track_my_location” /> </LinearLayout> </RelativeLayout> Then in java class, declare your location button: private ImageView imgMyLocation; imgMyLocation = (ImageView) findViewById(R.id.imgMyLocation); Click Event: … Read more

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