Code example for GoogleMap

Methods: addMarker, animateCamera

0
 
    private void moveMarkerTo(LatLng position) {
        if (mMarker != null) {
            mMarker.remove();
        } 
        mMarker = mMap.addMarker(new MarkerOptions().position(position));
        mMarker.setPosition(position);
    } 
 
    private void startGeocodingService() { 
        ReverseGeocodingService.IntentBuilder intentBuilder = new ReverseGeocodingService.IntentBuilder();
        intentBuilder.setLatLng(mLastQueryLat, mLastQueryLng);
        Intent intent = intentBuilder.build(this);
        startService(intent);
    } 
 
    @Override 
    protected void onResume() { 
        super.onResume(); 
        IntentFilter intentFilter = new IntentFilter(ReverseGeocodingService.RESPONSE_ACTION);
        mLocalBroadcastManager.registerReceiver(mGeocodingReceiver, intentFilter);
    } 
 
    @Override 
    protected void onPause() { 
        super.onPause(); 
        mLocalBroadcastManager.unregisterReceiver(mGeocodingReceiver);
    } 
 
    private void cleanUpAfterGeocoding() { 
        mLastQueryLat = null;
        setProgressBarIndeterminateVisibility(false); 
    } 
 
    private void centerMapAt(LatLng latLng) {
        CameraUpdate update = CameraUpdateFactory.newLatLng(latLng);
        mMap.animateCamera(update);
    } 
 
    @Override 
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);