title: Android GoogleMap or SupportMapFragment - null pointer exception
body: <p>In my app i showing google map version2 in a fragment. but i get Null pointer exception
  at </p>
  
  <p><code>mMap = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();</code></p>
  
  <p>This is my full code:</p>
  
  <pre><code>    public class SearchResultMap extends Fragment{
  
      private GoogleMap mMap;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
          View fragmentView = inflater.inflate(R.layout.map, container, false);
  
          mMap = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); // line no : 28
  
           mMap.addMarker(new MarkerOptions() .position(new LatLng(xxxxxx,xxxxxx)) .title("Current Location")
           .icon(BitmapDescriptorFactory.fromResource(R.drawable.ball_pointer))
           .snippet("xxxxx"));
  
          return fragmentView;
      }
  
      @Override
      public void onActivityCreated(Bundle savedInstanceState) {
          super.onActivityCreated(savedInstanceState);
      }
  
  }
  </code></pre>
  
  <p>xml:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
     &lt;fragment
          android:id="@+id/map"
          android:name="com.google.android.gms.maps.SupportMapFragment"
          android:layout_width="match_parent"
          android:layout_height="match_parent" /&gt; 
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Manifest xml:</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.fssd.spot"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="17" /&gt;
  
      &lt;permission
          android:name="com.fssd.spot.permission.MAPS_RECEIVE"
          android:protectionLevel="signature" /&gt;
  
      &lt;uses-feature
          android:glEsVersion="0x00020000"
          android:required="true" /&gt;
  
      &lt;uses-permission android:name="com.fssd.spot.permission.MAPS_RECEIVE" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name="com.fssd.spot.SplashScreen"
              android:theme="@android:style/Theme.Light.NoTitleBar"
              android:noHistory="true"
              android:screenOrientation="portrait" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name="com.fssd.spot.MainActivity"
              android:screenOrientation="portrait"
              android:theme="@style/tabTheme" &gt;
          &lt;/activity&gt;
  
          &lt;meta-data
              android:name="com.google.android.maps.v2.API_KEY"
              android:value="xxxxxxxxxxxxxxxxxxxxxxxx" /&gt;
  
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>whole log cat:</p>
  
  <pre><code>FATAL EXCEPTION: main
  java.lang.NullPointerException
  at com.fssd.spot.search.SearchResultMap.onCreateView(SearchResultMap.java:28)
  at android.support.v4.app.Fragment.performCreateView(Fragment.java:1478)
  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
  at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
  at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1460)
  at android.support.v4.app.Fragment.performStart(Fragment.java:1499)
  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:957)
  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
  at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
  at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1460)
  at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440)
  at android.os.Handler.handleCallback(Handler.java:587)
  at android.os.Handler.dispatchMessage(Handler.java:92)
  at android.os.Looper.loop(Looper.java:130)
  at android.app.ActivityThread.main(ActivityThread.java:3683)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:507)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:875)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:633)
  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>