title: Google map view corrupt with extend Fragment Class
body: <p>Hello I am new with android. this code work with extend Activity class but i use this class with extend with Fragment, Its not working. I addes added all the permissions in manifest. I use this Fragment class with the Bottom navigation menu. Please help me.</p>
  
  <p>This is my Fragment Class (LoctionFragment.java)</p>
  
  <pre><code>public class LoctionFragment extends Fragment implements OnMapReadyCallback, LocationListener{
  
  GoogleMap map;
  LocationManager locationManager;
  TextView viewLocation;
  
  
  public LoctionFragment() {
      // Required empty public constructor
  }
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      // Inflate the layout for this fragment
      View v = inflater.inflate(R.layout.location_layout, container, false);
  
      viewLocation = v.findViewById(R.id.viewLocation);
  
      SupportMapFragment mapFragment = (SupportMapFragment) getFragmentManager().findFragmentById(R.id.map);
      mapFragment.getMapAsync(this);
  
      locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
  
      if (ActivityCompat.checkSelfPermission(getContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &amp;&amp; ActivityCompat.checkSelfPermission(getContext(), android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
          // TODO: Consider calling
          //    ActivityCompat#requestPermissions
          // here to request the missing permissions, and then overriding
          //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
          //                                          int[] grantResults)
          // to handle the case where the user grants the permission. See the documentation
          // for ActivityCompat#requestPermissions for more details.
  
      }
      locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1, 1, (LocationListener) this);
      return v;
  }
  
  @Override
  public void onMapReady(GoogleMap googleMap) {
      map = googleMap;
  }
  
  @Override
  public void onLocationChanged(Location location) {
  
      map.clear();
      LatLng currentLocation = new LatLng(location.getLatitude(), location.getLongitude());
  
      MarkerOptions markerOptions = new MarkerOptions();
      markerOptions.position(currentLocation);
      markerOptions.title("MY LOCATION");
      map.addMarker(markerOptions);
      map.animateCamera(CameraUpdateFactory.newLatLngZoom(currentLocation, 17.0f));
      if (location != null) {
          double latti = location.getLatitude();
          double longi = location.getLongitude();
  
          viewLocation.setText("Current Location is :" + latti + "," + longi);
      } else {
          viewLocation.setText("Unable to find current location . Try again later");
      }
  }
  
  @Override
  public void onStatusChanged(String provider, int status, Bundle extras) {
  }
  
  @Override
  public void onProviderEnabled(String provider) {
  }
  
  @Override
  public void onProviderDisabled(String provider) {
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This is layout xml map view (location_layout.xml)</p>
  
  <pre><code>&lt;fragment
      android:id="@+id/map"
      android:name="com.google.android.gms.maps.SupportMapFragment"
      android:layout_width="match_parent"
      android:layout_height="383dp"
      android:layout_x="1dp"
      android:layout_y="39dp" /&gt;
  </code></pre>