title: Error inflating class fragment: Duplicate id , tag null, or parent id with another fragment
body: <p>I am trying to make an app in which when user clicks on item in ListView, the GoogleMaps is displayed.</p>
  
  <p>I have tried following code:</p>
  
  <p><strong>ShowPlacesActivity.java</strong></p>
  
  <pre><code>public class ShowPlaceActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_show_place);
          if (savedInstanceState == null) {
              getFragmentManager().beginTransaction()
                      .add(R.id.container_showplaces, new PlaceholderFragment())
                      .commit();
          }
          getActionBar().setSubtitle(getString(R.string.activity_showplaces_subtitle));
      }
  
  }
  </code></pre>
  
  <p><strong>activity_show_place.xml</strong></p>
  
  <pre><code>&lt;FrameLayout
  
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container_showplaces"
      android:layout_width="match_parent" android:layout_height="match_parent"
      tools:context="com.krupal.rememberthisplace.ShowPlaceActivity" tools:ignore="MergeRootFrame" /&gt;
  </code></pre>
  
  <p><strong>fragment_show_place.xml</strong></p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent" android:layout_height="match_parent"
      android:orientation="vertical"
  
      &gt;
  
  
      &lt;ListView
          android:id="@+id/listView_places"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
        /&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>fragment_maps.xml</strong></p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" &gt;
  
      &lt;fragment
          android:id="@+id/mymap"
          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>I want to show maps on listview's item click...so, I have implemented two fragments as follows:</p>
  
  <p>In <strong>PlaceholderFragment.java</strong>, I have set <code>onitemclicklistener</code> as:    </p>
  
  <pre><code>@Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                   Bundle savedInstanceState) {
              View rootView = inflater.inflate(R.layout.fragment_show_place, container, false);
  
  
  
              final MySqliteHelper db = new MySqliteHelper(getActivity().getBaseContext());
  
  
              listview_places = (ListView)rootView.findViewById(R.id.listView_places);
  
              final PlacesAdapter places_adapter = new PlacesAdapter(getActivity(),R.layout.listview_item_row,places);
  
  
              listview_places.setAdapter(places_adapter);
  
  
              listview_places.setLongClickable(true);
  
              listview_places.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  
                  @Override
                  public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                                          int position,long id) {
                      Place place = places_adapter.getItem(position);
                      String dbvaluename = place.getname();
  
                    Place selectedplace =  db.getPlace(dbvaluename);
  
  
                      dblatitude = selectedplace.getlatitude();
  
                      dblongitude = selectedplace.getlongitude();
  
  
                      dbplacename = place.getname();
  
                     maps = new MapsFragment();
                      Bundle bundle = new Bundle();
                      bundle.putDouble("dbplacename",dblatitude);
                      bundle.putDouble("dbplacename",dblongitude);
                      bundle.putString("dbplacename",dbplacename);
                     maps.setArguments(bundle);
                      FragmentManager fm = getFragmentManager();
  
                      FragmentTransaction ft = fm.beginTransaction();
  
                      ft.replace(R.id.container_showplaces,maps);
  
                      ft.addToBackStack(null);
  
                      ft.commit();
  
                  }
  
  
  
          });
  }
  }
  </code></pre>
  
  <p>and In <strong>MapsFragment.java</strong>, I have shown maps as:</p>
  
  <pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
  
  
     rootView = inflater.inflate(R.layout.fragment_maps, container, false);
  
  
      try {
          // Loading map
          initilizeMap();
  
      } catch (Exception e) {
          e.printStackTrace();
      }
      return rootView;
  }
  </code></pre>
  
  <p>When I click first time on ListView's item, it shows the Map...Then, when I select another item, it crashes:</p>
  
  <p><strong>Logcat log:</strong></p>
  
  <blockquote>
    <p>android.view.InflateException: Binary XML file line #7: Error
    inflating class fragment
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
            at com.krupal.rememberthisplace.MapsFragment.onCreateView(MapsFragment.java:40)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:828)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1032)
            at android.app.BackStackRecord.run(BackStackRecord.java:622)
            at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1382)
            at android.app.FragmentManagerImpl$1.run(FragmentManager.java:426)
            at android.os.Handler.handleCallback(Handler.java:605)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4424)
            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:825)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
            at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.IllegalArgumentException: Binary XML file line #7: Duplicate
    id 0x7f0b001e, tag null, or parent id 0xffffffff with another fragment
    for com.google.android.gms.maps.MapFragment
            at android.app.Activity.onCreateView(Activity.java:4248)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:673)
                at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
                at com.krupal.rememberthisplace.MapsFragment.onCreateView(MapsFragment.java:40)
                at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:828)
                at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1032)
                at android.app.BackStackRecord.run(BackStackRecord.java:622)
                at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1382)
                at android.app.FragmentManagerImpl$1.run(FragmentManager.java:426)
                at android.os.Handler.handleCallback(Handler.java:605)
                at android.os.Handler.dispatchMessage(Handler.java:92)
                at android.os.Looper.loop(Looper.java:137)
                at android.app.ActivityThread.main(ActivityThread.java:4424)
                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:825)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
                at dalvik.system.NativeStart.main(Native Method)</p>
  </blockquote>
  
  <p><strong>EDIT:</strong> <a href="https://stackoverflow.com/questions/14083950/duplicate-id-tag-null-or-parent-id-with-another-fragment-for-com-google-androi?rq=1">this</a> soloution didn't work for me</p>