「青い点」の位置座標を取得し、それを最初のマップビュー読み込みの中心として設定しようとしています。しかし、ヌルポインタ例外が発生しています。
ここで何が欠けていますか?
public class GetLocationActivity extends MapActivity implements OnClickListener {
private MapView location;
private LocationMarker locationMarker;
private MyLocationOverlay locationOverlay;
private GeoPoint destination;
private GeoPoint source;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.location);
location = (MapView) this.findViewById(R.id.location);
location.setBuiltInZoomControls(true);
location.setClickable(true);
location.setLongClickable(true);
location.getController().setZoom(12);
locationMarker = new LocationMarker(this, location, marker,
(ImageView) findViewById(R.id.drag));
location.getOverlays().add(locationMarker);
locationOverlay = new MyLocationOverlay(this, location);
location.getOverlays().add(locationOverlay);
source = locationOverlay.getMyLocation();
location.getController().setCenter(
new GeoPoint(source.getLatitudeE6(), source.getLongitudeE6()));
}
で nullPointer を取得しsource.getLatitudeE6()
ます。