Guest User

Untitled

a guest
Jan 22nd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. xmlns:app="http://schemas.android.com/apk/res-auto"
  3. xmlns:map="http://schemas.android.com/apk/res-auto"
  4. xmlns:tools="http://schemas.android.com/tools"
  5. android:layout_width="match_parent"
  6. android:layout_height="match_parent">
  7.  
  8. <fragment
  9. android:id="@+id/map"
  10. android:name="com.google.android.gms.maps.SupportMapFragment"
  11. android:layout_width="match_parent"
  12. android:layout_height="match_parent"
  13. tools:context="isttechnology.project.MapsActivity" />
  14. </LinearLayout>
  15.  
  16.  
  17. public class MapsFragment extends Fragment implements OnMapReadyCallback {
  18. private GoogleMap mMap;
  19. @Override
  20. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  21. View view = inflater.inflate(R.layout.activity_maps, container, false);
  22. SupportMapFragment mapFragment = getChildFragmentManager().findFragmentById(R.id.map);
  23. mapFragment.getMapAsync(this);
  24. return view;
  25. }
  26.  
  27. @Override
  28. public void onMapReady(GoogleMap googleMap) {
  29. mMap = googleMap;
  30.  
  31. // Add a marker in Sydney and move the camera
  32. LatLng sydney = new LatLng(-34, 151);
  33. mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
  34. mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
  35. }
Add Comment
Please, Sign In to add comment