I have an xml layout which includes the following code:
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="100dp"
android:name="com.google.android.gms.maps.SupportMapFragment" />
This layout can be inflated in the main activity more than once and, in that case, should display multiple MapFragments. When that happens, however, I get the following error:
Duplicate id 0x7f0a0213, tag null, or parent id 0xffffffff with another fragment for com.google.android.gms.maps.SupportMapFragment
From my understanding, this happens because you can't have more than 1 <fragment>
with the same id.
How can I inflate these views with these map fragments multiple times? Is it possible to assign different ID's to each fragment every time the layout is inflated?
EDIT: I found this. I guess I can't set the ID of the fragment itself programmatically.