-2

I'm following the google maps tutorial for Android here: https://developers.google.com/maps/documentation/android-sdk/current-place-tutorial

My question is, once I get to the 'Add a map' section, is that code for my fragment's java? Or the main java that was for the first part?

Thanks.

  • Yes it the same for your main java file which will be your main activity file. You can add the map at any activity or fragment you want. – Hardik Vegad Jul 19 '18 at 23:13

1 Answers1

0
the doc clearly says that 
"
Add a <fragment> element to your activity's layout file, activity_maps.xml.  "

so the the "activity_maps.xml" is the activity layout file and the following code should be inside the "activity_maps.xml"


<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.currentplacedetailsonmap.MapsActivityCurrentPlace" />

refer the this link if you find it helpful

https://stackoverflow.com/questions/20314635/android-map-in-fragment
RAINA
  • 802
  • 11
  • 22