In my application I have two tab (map and nearby). Both fragments are using map fragment.
Here is my map.xml
<RelativeLayout
android:id="@+id/countryLayout"
android:layout_below="@id/partnersLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/mainFooterLayout">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
</FrameLayout>
</RelativeLayout>
Here is my inflated code
View view = inflater.inflate(R.layout.map, container, false);
and in NearbyFragment and MyMapFragment I called
public void onDestroyView() {
super.onDestroyView();
Fragment fragment = (getFragmentManager().findFragmentById(R.id.map));
FragmentTransaction ft = mActivity.getFragmentManager().beginTransaction();
ft.remove(fragment);
ft.commit();
}
but still my application crashed
I have this exception
Caused by: java.lang.IllegalArgumentException: Binary XML file line #42: Duplicate id 0x7f0600b5, tag null, or parent id 0xffffffff with another fragment for com.google.android.gms.maps.MapFragment
Could anyone tell me what is wrong here?
Is it possible that I use MapFragment instead of SupportMapFragment?
Thank you
See what you should do:
1) Define activity layout:
2) Create adapter for your tabulated pager:
3) Create main activity with tabs
Inside Adapter you have to create instances of fragmnets what you need to place in your activity like a tabs
P.S. sorry for my english and typo