Code example for MarkerOptions

Methods: draggable, icon, position, title

0
package com.socmaps.widget; 
 
 
import android.content.Intent; 
import android.os.Bundle; 
import android.os.Handler; 
import android.os.Message; 
import android.support.v4.app.FragmentActivity; 
import android.support.v4.app.FragmentManager; 
import android.util.Log; 
import android.view.KeyEvent; 
import android.view.View; 
import android.view.View.OnClickListener; 
import android.widget.Button; 
import android.widget.TextView; 
 
import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.GoogleMap.OnCameraChangeListener; 
import com.google.android.gms.maps.GoogleMap.OnMapClickListener; 
import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener; 
import com.google.android.gms.maps.GoogleMap.OnMarkerDragListener; 
import com.google.android.gms.maps.SupportMapFragment; 
import com.google.android.gms.maps.model.BitmapDescriptorFactory; 
import com.google.android.gms.maps.model.CameraPosition; 
import com.google.android.gms.maps.model.LatLng; 
import com.google.android.gms.maps.model.Marker; 
import com.google.android.gms.maps.model.MarkerOptions; 
import com.socmaps.ui.R; 
import com.socmaps.util.Utility; 
 
/** 
 * LocationPicker MapActivity for providing expected location. 
 */ 
public class LocationPickerProfile extends FragmentActivity implements OnClickListener, OnCameraChangeListener, OnMapClickListener, OnMarkerDragListener, OnMarkerClickListener {
 
	private TextView showLocation;
	private double lat = 0.0, lng = 0.0;
	private String address = null;
	private String name = null;
	private Button btnOk, btnCancel;
	private GoogleMap mapView;
 
	@Override 
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.location_picker_layout_profile); 
		init(); 
		getIntentData(); 
 
		updateMap(); 
 
	} 
 
	private void getIntentData() { 
		// TODO Auto-generated method stub 
		lat = getIntent().getDoubleExtra("LAT", 0);
		lng = getIntent().getDoubleExtra("LNG", 0);
	} 
 
	private void updateMap() { 
		LatLng latLng = new LatLng(lat, lng);
		MarkerOptions markerOptions = new MarkerOptions();
		markerOptions.title("");
		markerOptions.icon(BitmapDescriptorFactory.defaultMarker());
		markerOptions.position(latLng);
		markerOptions.draggable(false);
		mapView.addMarker(markerOptions);
 
		mapView.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 12));
 
		Utility.getAddressByCoordinate(lat, lng, new LocationAddressHandler());