content: package id.merahmuda.bcd.fragment;
  
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  import com.google.android.gms.maps.CameraUpdateFactory;
  import com.google.android.gms.maps.GoogleMap;
  import com.google.android.gms.maps.MapView;
  import com.google.android.gms.maps.MapsInitializer;
  import com.google.android.gms.maps.OnMapReadyCallback;
  import com.google.android.gms.maps.SupportMapFragment;
  import com.google.android.gms.maps.model.LatLng;
  import com.google.android.gms.maps.model.MarkerOptions;
  
  import id.merahmuda.bcd.R;
  
  /**
   * Created by Ujang Wahyu on 03,Oktober,2018
   */
  public class MapFragment extends Fragment  {
      private static final String TAG = MapFragment.class.getSimpleName();
      private GoogleMap mMap;
      private SupportMapFragment mapFragment;
      private Double latitude = -6.9175431;
      private Double longitude = 107.6090739;
  
      public MapFragment() {
      }
  
      public static MapFragment newInstance(int tabSelected) {
          MapFragment fragment = new MapFragment();
          Bundle args = new Bundle();
          args.putInt("position", tabSelected);
          fragment.setArguments(args);
          return fragment;
      }
  
      @Override
      public void onCreate(@Nullable Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.fragment_map, null);
          getActivity().setTitle("Map");
  
          if (mapFragment == null) {
              mapFragment = SupportMapFragment.newInstance();
              mapFragment.getMapAsync(new OnMapReadyCallback() {
                  @Override
                  public void onMapReady(GoogleMap googleMap) {
                      LatLng latLng = new LatLng(latitude, longitude);
                      googleMap.addMarker(new MarkerOptions().position(latLng)
                              .title("Singapore"));
                      googleMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));
                      googleMap.setMinZoomPreference(15.0f);
                      googleMap.setMaxZoomPreference(20.0f);
                  }
              });
          }
  
          getChildFragmentManager().beginTransaction().replace(R.id.map, mapFragment).commit();
  
          return view;
      }
  
  
      @Override
      public void onDetach() {
          super.onDetach();
      }
  
      @Override
      public void onResume() {
          super.onResume();
      }
  
      @Override
      public void onPause() {
          super.onPause();
      }
  
  }