Code example for GoogleMap

Methods: aW, getUiSettings, setMyLocationEnabled, setOnMyLocationChangeListener

0
package com.lb.logic; 
 
import java.util.Iterator; 
import java.util.List; 
 
import com.lb.R; 
import com.google.android.gms.maps.CameraUpdate; 
import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.GoogleMap.OnMapClickListener; 
import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener; 
import com.google.android.gms.maps.GoogleMap.OnMyLocationChangeListener; 
import com.google.android.gms.maps.SupportMapFragment; 
import com.google.android.gms.maps.UiSettings; 
import com.google.android.gms.maps.model.BitmapDescriptorFactory; 
import com.google.android.gms.maps.model.CameraPosition; 
import com.google.android.gms.maps.model.Circle; 
import com.google.android.gms.maps.model.CircleOptions; 
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.google.android.gms.maps.model.Polyline; 
import com.google.android.gms.maps.model.PolylineOptions; 
 
import android.content.Context; 
import android.graphics.Color; 
import android.location.Location; 
import android.util.Log; 
 
public class MapLogic extends LogicBase { 
 
	GoogleMap map;
	SupportMapFragment mapFragment;
	 
	public MapLogic(Context context, SupportMapFragment mapFragment) {
		super(context);
		this.mapFragment = mapFragment;
	} 
 
	public void init(){ 
		this.map = mapFragment.getMap();
		this.map.setMyLocationEnabled(true);
		UiSettings settings = this.map.getUiSettings();
		settings.setMyLocationButtonEnabled(true);
 
		// カメラを現在位置にフォーカスする 
		map.setOnMyLocationChangeListener(new OnMyLocationChangeListener(){
		      @Override 
		      public void onMyLocationChange(Location location) {
		    	  moveCamera(location.getLatitude(), location.getLongitude(), 15);
		    	  map.setOnMyLocationChangeListener(null); // 一回移動したらリスナーを殺す
		      }