В моем приложении я использую google map программно, но когда я вызываю getMap(), он возвращает null. Даже я пробовал onActivityCreated(), но все равно возвращает null. кто-то пожалуйста, помогите мне .. Вот мой код,Google map v2 метод android getMap() возвращает null
public void callMap() {
try {
int status = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(mActivity);
if (status == ConnectionResult.SUCCESS) {
Log.d("sreedhu", "Google Play Service Available");
gmo = (new GoogleMapOptions()).zoomControlsEnabled(true)
.rotateGesturesEnabled(true);
mapFragment = SupportMapFragment.newInstance(gmo);
map=mapFragment.getMap();
manager=getFragmentManager();
FragmentTransaction fragmentTransaction = manager
.beginTransaction();
fragmentTransaction.add(R.id.mapFragmentHole, mapFragment);
fragmentTransaction.commit();
manager.executePendingTransactions();
mapFragment=getMap();
} else if (GooglePlayServicesUtil.isUserRecoverableError(status)) {
ErrorDialogFragment.newInstance(status).show(
getFragmentManager(), "errorDialog");
} else {
Toast.makeText(mActivity, "Google Map v2 not available",
Toast.LENGTH_LONG).show();
mActivity.popFragments();
}
} catch (Exception e) {
Log.d("sreedhu", "play" + e.toString());
}
}
post ur logcat мощность ..! – TheFlash
, так как я написал все под try catch, он показывает только исключение null-указателя. –