I found a solution . The map may not have been initialized yet, try getMap() in a later point of the lifecycle, like onResume()
My code is
protected void onResume() {
super.onResume();
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
if (resultCode == ConnectionResult.SUCCESS){
Toast.makeText(getApplicationContext(),
"isGooglePlayServicesAvailable SUCCESS",
Toast.LENGTH_LONG).show();
if(gMap == null){
gMap = mMapView.getMap();
if(gMap != null){
gMap.setMyLocationEnabled(true);
gMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
}else{
Toast.makeText(getApplicationContext(),
"cannot getMap!",
Toast.LENGTH_LONG).show();
}
}
}else{
GooglePlayServicesUtil.getErrorDialog(resultCode, this, RQS_GooglePlayServices);
}
}
Try this to add custom marker:
Edited you have done below step:
add above library project in to your project. run in Android Device only not in Emulator
it is simple check below code:
more detail check this : clickhere & clickhere
as per your code check this: