Skip to content Skip to sidebar Skip to footer

Set Camera Focus On Particular Marker On Google Map On Listview Item Click

What i want : I want to set focus on marker that is already placed in google map. When i click on list view item , focus of camera should be transfer to that poistion marker on

Solution 1:

Try this,

GoogleMap map = ((MapFragment)     getFragmentManager().findFragmentById(R.id.map)).getMap();

//Pass the latitude and Longitude to method

setMap(Dlat, Dlng);

privatevoidsetMap(double dlat, double dlng) {

    LatLnglocation=newLatLng(dlat, dlng);
    CameraPositionINIT=newCameraPosition.Builder().target(location).zoom(15.5F).bearing(300F) // orientation
            .tilt(50F) // viewing angle
            .build();

    // use map to move camera into position
    map.moveCamera(CameraUpdateFactory.newCameraPosition(INIT));

    // create initial marker
    markerOptions = newMarkerOptions().position(location);
    map.addMarker(markerOptions);

}

Post a Comment for "Set Camera Focus On Particular Marker On Google Map On Listview Item Click"