Error opening MapFragment for second time
<p>I used a sliding menu and I had a map fragment,  when I clicked on the location menu for a first time it worked without problem but for a second time I get the following error:</p>

<pre><code>FATAL EXCEPTION: main
                                             android.view.InflateException: Binary XML file line #34: Error inflating class fragment
                                                 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
                                                 at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
                                                 at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
                                                 at mdev.com.mymemories.fragment.LocationFragment.onCreateView(LocationFragment.java:70)
                                                 at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:829)
                                                 at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035)
                                                 at android.app.BackStackRecord.run(BackStackRecord.java:635)
                                                 at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1397)
                                                 at android.app.FragmentManagerImpl$1.run(FragmentManager.java:426)
                                                 at android.os.Handler.handleCallback(Handler.java:615)
                                                 at android.os.Handler.dispatchMessage(Handler.java:92)
                                                 at android.os.Looper.loop(Looper.java:137)
                                                 at android.app.ActivityThread.main(ActivityThread.java:4745)
                                                 at java.lang.reflect.Method.invokeNative(Native Method)
                                                 at java.lang.reflect.Method.invoke(Method.java:511)
                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                                                 at dalvik.system.NativeStart.main(Native Method)
                                              Caused by: java.lang.IllegalArgumentException: Binary XML file line #34: Duplicate id 0x7f0d00be, tag null, or parent id 0xffffffff with another fragment for com.google.android.gms.maps.MapFragment
</code></pre>

<p>The XML file:</p>

<pre><code>  &lt;?xml version="1.0" encoding="utf-8"?&gt;
 &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:background="@drawable/bg16"&gt;
&lt;LinearLayout
    android:layout_marginBottom="10dp"
    android:id="@+id/ln"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"&gt;
    &lt;Button
        android:id="@+id/curent_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="0.5"
        android:text="@string/btnposition" /&gt;

&lt;/LinearLayout&gt;
&lt;fragment
    android:layout_marginTop="50dp"
    android:layout_gravity="center"
    android:layout_marginRight="5dp"
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.MapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/&gt;
 &lt;/RelativeLayout&gt;
</code></pre>

<p>MyView.class:</p>

<pre><code>public class LocationFragment extends Fragment {
View rootView;
public LocationFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
     rootView = inflater.inflate(R.layout.fragment2, container, false);
 }
 }
</code></pre>

<p><a href="https://i.stack.imgur.com/1mBTZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1mBTZ.png" alt="sliding menu"></a></p>