title: Not able to get current location in Google Map fragment
body: <p>I am trying to get current location in map fragment but the crashes with an error in line googleMap.setMyLocationEnabled(true);
  I used Location and Latlang to detect current location.</p>
  
  <p>mapFragment.java</p>
  
  <pre><code>public class mapFragment extends Fragment {
  
      MapView mMapView;
      private GoogleMap googleMap;
      Location location;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // inflat and return the layout
          View v = inflater.inflate(R.layout.fragment_map, container,
                  false);
          mMapView = (MapView) v.findViewById(R.id.mapView);
          mMapView.onCreate(savedInstanceState);
  
          mMapView.onResume();// needed to get the map to display immediately
  
          try {
              MapsInitializer.initialize(getActivity().getApplicationContext());
          } catch (Exception e) {
              e.printStackTrace();
          }
          googleMap.setMyLocationEnabled(true);
          googleMap = mMapView.getMap();
          // latitude and longitude
          LatLng lat = new LatLng(location.getLatitude(), location.getLongitude());
          /*double latitude = 17.385044;
          double longitude = 78.486671;*/
  
          // create marker
          MarkerOptions marker = new MarkerOptions().position(
                  lat).title("Hello Maps");
  
          // Changing marker icon
          marker.icon(BitmapDescriptorFactory
                  .defaultMarker(BitmapDescriptorFactory.HUE_ROSE));
  
          // adding marker
          googleMap.addMarker(marker);
          CameraPosition cameraPosition = new CameraPosition.Builder()
                  .target(lat).zoom(12).build();
          googleMap.animateCamera(CameraUpdateFactory
                  .newCameraPosition(cameraPosition));
  
          // Perform any camera updates here
          return v;
      }
  
  
      @Override
      public void onResume() {
          super.onResume();
          mMapView.onResume();
      }
  
      @Override
      public void onPause() {
          super.onPause();
          mMapView.onPause();
      }
  
      @Override
      public void onDestroy() {
          super.onDestroy();
          mMapView.onDestroy();
      }
  
      @Override
      public void onLowMemory() {
          super.onLowMemory();
          mMapView.onLowMemory();
      }
  }
  </code></pre>
  
  <p>fragment_map.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;com.google.android.gms.maps.MapView
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/mapView"
      android:layout_width="match_parent"
      android:layout_height="match_parent" /&gt;
  </code></pre>