Code example for GoogleMap

Methods: aW, getUiSettings, setOnMapClickListener, setOnMarkerClickListener

0
package org.jyu.itks545; 
 
import org.json.JSONArray; 
import org.json.JSONException; 
import org.json.JSONObject; 
 
import android.os.Bundle; 
import android.util.Log; 
import android.view.LayoutInflater; 
import android.view.View; 
import android.view.ViewGroup; 
 
import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener; 
import com.google.android.gms.maps.SupportMapFragment; 
import com.google.android.gms.maps.UiSettings; 
import com.google.android.gms.maps.model.LatLng; 
import com.google.android.gms.maps.model.Marker; 
import com.google.android.gms.maps.model.MarkerOptions; 
 
public class MyMapFragment extends SupportMapFragment implements AsyncCallback, OnMarkerClickListener {
 
    private static final String TAG = MyMapFragment.class.getSimpleName();
    /** 
     * Note that this may be null if the Google Play services APK is not 
     * available. 
     */ 
    private GoogleMap mMap;
 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRetainInstance(true); 
    } 
 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View view = super.onCreateView(inflater, container, savedInstanceState);
        return view;
    } 
 
    @Override 
    public void onResume() { 
        super.onResume(); 
 
        mMap = getMap();
        mMap.setOnMarkerClickListener(this);
        initMap(); 
        getAllMarkers(); 
    } 
 
    private void initMap() { 
        UiSettings settings = mMap.getUiSettings();
        settings.setAllGesturesEnabled(true);
        settings.setMyLocationButtonEnabled(false);
    } 
 
    public void setPosition(LatLng latLng) {
        mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
        mMap.moveCamera(CameraUpdateFactory.zoomTo(16));
    }