我在片段中的以下代码执行时遇到 numm 指针异常。
MapFragment mapFragment = MapFragment.newInstance();
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.container1, mapFragment);
fragmentTransaction.commit();
mGoogleMap=mapFragment.getMap();
mGoogleMap.addMarker(new MarkerOptions().draggable(true).position(new LatLng(22.03, 72.56)).title("hello world").snippet("Ahmedabad").icon(BitmapDescriptorFactory.fromResource(R.drawable.wifi)));
03-01 15:59:49.370:E/AndroidRuntime(12577):引起:java.lang.NullPointerException 03-01 15:59:49.370:E/AndroidRuntime(12577):在 com.tfick.fragment.PoiFragment.onCreateView (PoiFragment.java:64) 03-01 15:59:49.370: E/AndroidRuntime(12577): 在 android.app.FragmentManagerImpl.moveToState(FragmentManager.java:829) 03-01 15:59:49.370: E/AndroidRuntime (12577): 在 android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035) 03-01 15:59:49.370: E/AndroidRuntime(12577): 在 android.app.BackStackRecord.run(BackStackRecord.java:635) 03-01 15:59:49.370: E/AndroidRuntime(12577): 在 android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1397)