title: How can I get current location on mapview using fragment class?
body: <p>Hello I am new in android development and i want to get current location in mapview using fragment class. when i am adding setMyLocationEnabled method it is asking for permissions and i have added all the permissions in manifest. Please help me .</p>
  
  <p>Gmaps.java (fragment)</p>
  
  <pre><code>public class Gmaps extends Fragment implements OnMapReadyCallback {
  
  private GoogleMap googleMap;
  private MapView mapView;
  private boolean mapsSupported = true;
  private GoogleApiClient mGoogleApiClient;
  
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      MapsInitializer.initialize(getActivity());
  
      if (mapView != null) {
          mapView.onCreate(savedInstanceState);
      }
      initializeMap();
  }
  
  private void initializeMap() {
      if (googleMap == null &amp;&amp; mapsSupported) {
          mapView = (MapView) getActivity().findViewById(R.id.map);
          googleMap = mapView.getMap();
  
          double latitude = 0.00;
          double longitude = 0.00;
  
          MarkerOptions marker = new MarkerOptions().position(new LatLng(latitude, longitude)).title("Marker");
  
          googleMap.addMarker(marker);
  
          CameraPosition cameraPosition = new CameraPosition.Builder().target(
                  new LatLng(0, 0)).zoom(12).build();
  
          googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
  
  
          googleMap.getUiSettings().setZoomControlsEnabled(true); // true to enable
          googleMap.getUiSettings().setZoomGesturesEnabled(true);
          googleMap.getUiSettings().setCompassEnabled(true);
          googleMap.getUiSettings().setMyLocationButtonEnabled(true);
          googleMap.getUiSettings().setRotateGesturesEnabled(true);
      }
  }
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      final FrameLayout p = (FrameLayout) inflater.inflate(R.layout.fragment_gmaps, container, false);
      mapView = (MapView) p.findViewById(R.id.map);
  
      return p;
  }
  
  @Override
  public void onSaveInstanceState(Bundle outState) {
      super.onSaveInstanceState(outState);
      mapView.onSaveInstanceState(outState);
  }
  
  @Override
  public void onResume() {
      super.onResume();
      mapView.onResume();
      initializeMap();
  }
  
  @Override
  public void onPause() {
      super.onPause();
      mapView.onPause();
  }
  
  @Override
  public void onDestroy() {
      super.onDestroy();
      mapView.onDestroy();
  }
  
  @Override
  public void onLowMemory() {
      super.onLowMemory();
      mapView.onLowMemory();
  }
  
  @Override
  public void onMapReady(GoogleMap googleMap) {
  
  }
  </code></pre>
  
  <p>In Manifest,  I have added all these permissions used for google map services</p>