Search code examples
androidgoogle-mapsgoogle-maps-api-2

Google Maps v2 zoom to specific marker


I have a search AutoComplete in my map and display the title from my database. Can it be possible to put zoom functionality to that specific marker? I'm using google maps api v2.

map search


Solution

  • Look at these code snippets: https://developers.google.com/maps/documentation/android/

    This should be what you're looking for:

    GoogleMap map = ((MapFragment) getFragmentManager()
            .findFragmentById(R.id.map)).getMap();
    
    LatLng sydney = new LatLng(-33.867, 151.206);
    
    map.setMyLocationEnabled(true);
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 13));