title: google map Unable to start activity ComponentInfo android.view.InflateException: Binary XML file line #6: Error inflating class fragment
body: <p>I am trying to build an application with google map , when i try to run am getting error</p>
  
  <p>But I am getting following error</p>
  
  <pre><code>05-20 17:38:42.448: W/dalvikvm(722): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
  05-20 17:38:42.458: E/AndroidRuntime(722): FATAL EXCEPTION: main
  05-20 17:38:42.458: E/AndroidRuntime(722): java.lang.RuntimeException: Unable to resume activity {info.androidhive.googlemapsv2/info.androidhive.googlemapsv2.MainActivity}: java.lang.NullPointerException
  05-20 17:38:42.458: E/AndroidRuntime(722):  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2575)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2603)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2089)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at android.app.ActivityThread.access$600(ActivityThread.java:130)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at android.os.Handler.dispatchMessage(Handler.java:99)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at android.os.Looper.loop(Looper.java:137)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at android.app.ActivityThread.main(ActivityThread.java:4745)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at java.lang.reflect.Method.invokeNative(Native Method)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at java.lang.reflect.Method.invoke(Method.java:511)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at dalvik.system.NativeStart.main(Native Method)
  05-20 17:38:42.458: E/AndroidRuntime(722): Caused by: java.lang.NullPointerException
  05-20 17:38:42.458: E/AndroidRuntime(722):  at info.androidhive.googlemapsv2.MainActivity.initilizeMap(MainActivity.java:135)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at info.androidhive.googlemapsv2.MainActivity.onResume(MainActivity.java:126)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1184)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at android.app.Activity.performResume(Activity.java:5082)
  05-20 17:38:42.458: E/AndroidRuntime(722):  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2565)
  05-20 17:38:42.458: E/AndroidRuntime(722):  ... 12 more
  </code></pre>
  
  <p><strong>Activity main XML</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;fragment xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/map"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            class="com.google.android.gms.maps.SupportMapFragment"/&gt;
  </code></pre>
  
  <p>MainActivity.java</p>
  
  <pre><code>package info.androidhive.googlemapsv2;
  
  import android.os.Bundle;
  import android.support.v4.app.FragmentActivity;
  import android.util.Log;
  import android.widget.Toast;
  
  import com.google.android.gms.maps.CameraUpdateFactory;
  import com.google.android.gms.maps.GoogleMap;
  import com.google.android.gms.maps.MapFragment;
  import com.google.android.gms.maps.model.BitmapDescriptorFactory;
  import com.google.android.gms.maps.model.CameraPosition;
  import com.google.android.gms.maps.model.LatLng;
  import com.google.android.gms.maps.model.MarkerOptions;
  
  public class MainActivity extends FragmentActivity  {
  
      // Google Map
      private GoogleMap googleMap;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
           try{
                _SetMap();
           }catch(Exception e){
              e.printStackTrace();
           }
  
      }
  
      @Override
      protected void onResume() {
          super.onResume();
          initilizeMap();
      }
  
      /**
       * function to load map If map is not created it will create it for you
       * */
  
      private void _SetMap() {
          if (googleMap == null)
              googleMap = ((MapFragment) getFragmentManager().findFragmentById(
                      R.id.map)).getMap();
          googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
      }
  
  
      private void initilizeMap() {
          if (googleMap == null) {
              googleMap = ((MapFragment) getFragmentManager().findFragmentById(
                      R.id.map)).getMap();
  
              // check if map is created successfully or not
              if (googleMap == null) {
                  Toast.makeText(getApplicationContext(),
                          "Sorry! unable to create maps", Toast.LENGTH_SHORT)
                          .show();
              }
          }
      }
  
      /*
       * creating random postion around a location for testing purpose only
       */
      private double[] createRandLocation(double latitude, double longitude) {
  
          return new double[] { latitude + ((Math.random() - 0.5) / 500),
                  longitude + ((Math.random() - 0.5) / 500),
                  150 + ((Math.random() - 0.5) * 10) };
      }
  }
  </code></pre>
  
  <p>Any body please help me to solve this</p>