Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:map="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <fragment
- android:id="@+id/map"
- android:name="com.google.android.gms.maps.SupportMapFragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context="isttechnology.project.MapsActivity" />
- </LinearLayout>
- public class MapsFragment extends Fragment implements OnMapReadyCallback {
- private GoogleMap mMap;
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.activity_maps, container, false);
- SupportMapFragment mapFragment = getChildFragmentManager().findFragmentById(R.id.map);
- mapFragment.getMapAsync(this);
- return view;
- }
- @Override
- public void onMapReady(GoogleMap googleMap) {
- mMap = googleMap;
- // Add a marker in Sydney and move the camera
- LatLng sydney = new LatLng(-34, 151);
- mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
- mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
- }
Add Comment
Please, Sign In to add comment