map から自分の場所を取得できません。null ポインター例外がスローされます。
if (mMap == null) {
// Try to obtain the map from the SupportMapFragment.
try {
mMap = ((SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.mapFrag)).getMap();
} catch (Exception e) {
e.printStackTrace();
}
}
// Check if we were successful in obtaining the map.
if (mMap != null) {
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
mMap.setMyLocationEnabled(true);
mMap.getUiSettings().setMyLocationButtonEnabled(true);
mMap.getUiSettings().setZoomControlsEnabled(true);
putMarkerOnMap(mMap.getMyLocation().getLatitude(),mMap.getMyLocation().getLongitude());
}
行でエラーがスローされます..関数 putMarkerOnMap(lat,lng) を呼び出している場所は、その関数です
public void putMarkerOnMap(double la , double lo){
LatLng position = new LatLng(la,lo);
mMap.addMarker(new MarkerOptions().position(new LatLng(la, lo)).title("Your Location"));
CameraPosition campos = new CameraPosition.Builder().target(position).zoom(15)
.bearing(90)
.tilt(40)
.build();
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(campos));
}