Skip to content Skip to sidebar Skip to footer

Move Marker Along With Blue Circle

I am working on google map. I observed that the blue circle (which shows the movement) is accurate but the marker will remain at the last position. I have added the marker onLocat

Solution 1:

Try this..

@Override
    public void onLocationChanged(Location location) {
        double latitude = location.getLatitude();
        double longitude = location.getLongitude();
        LatLng latLng = new LatLng(latitude, longitude);
        if (myMarker == null) {
            myMarker = googleMap.addMarker(new MarkerOptions().position(latLng).icon(
                    BitmapDescriptorFactory.fromBitmap(resize(R.drawable.my_marker))));
            googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));

        } else {
            myMarker.setPosition(latLng);
        }
    }
}

Post a Comment for "Move Marker Along With Blue Circle"