title: Binary XML file line #10: Error inflating class fragment
body: <p>In my project I use three tab to show three activities in single screen. 
  Tab 1 - Map
  <Br>Tab 2 - Games
  <Br>Tab 3 - Imageflipper
  <Br> When I select tabs in series like Map--->Games--->Imageflipper then It work fine.
  <Br>But when I select back to any tab like Map--->Games--->Imageflipper--->>Games,  Then it show me error-
  <br>Binary XML file line #10: Error inflating class fragment.</p>
  
  <p>Screen shot of Emulator:</p>
  
  <p><a href="http://s9.postimg.org/jdjsxnswf/Untitled.png" rel="nofollow">http://s9.postimg.org/jdjsxnswf/Untitled.png</a></p>
  
  <p><br>
      This is my logcat.
     <br></p>
  
  <pre><code>03-26 05:48:09.876: D/AndroidRuntime(1094): Shutting down VM
  03-26 05:48:09.876: W/dalvikvm(1094): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
  03-26 05:48:09.936: E/AndroidRuntime(1094): FATAL EXCEPTION: main
  03-26 05:48:09.936: E/AndroidRuntime(1094): android.view.InflateException: Binary XML file line #10: Error inflating class fragment
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at com.example.image_changer.TopRatedFragment.onCreateView(TopRatedFragment.java:15)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.support.v4.app.FragmentManagerImpl.attachFragment(FragmentManager.java:1264)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:672)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:461)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.support.v4.view.ViewPager.populate(ViewPager.java:1012)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:523)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:495)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:476)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at com.example.image_changer.MainActivity1.onTabSelected(MainActivity1.java:82)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at com.android.internal.app.ActionBarImpl.selectTab(ActionBarImpl.java:570)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at com.android.internal.app.ActionBarImpl$TabImpl.select(ActionBarImpl.java:1067)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at com.android.internal.widget.ScrollingTabContainerView$TabClickListener.onClick(ScrollingTabContainerView.java:519)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.view.View.performClick(View.java:4202)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.view.View$PerformClick.run(View.java:17340)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.os.Handler.handleCallback(Handler.java:725)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.os.Handler.dispatchMessage(Handler.java:92)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.os.Looper.loop(Looper.java:137)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.app.ActivityThread.main(ActivityThread.java:5039)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at java.lang.reflect.Method.invokeNative(Native Method)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at java.lang.reflect.Method.invoke(Method.java:511)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at dalvik.system.NativeStart.main(Native Method)
  03-26 05:48:09.936: E/AndroidRuntime(1094): Caused by: java.lang.IllegalArgumentException: Binary XML file line #10: Duplicate id 0x7f050010, tag null, or parent id 0x0 with another fragment for com.google.android.gms.maps.SupportMapFragment
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:285)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
  03-26 05:48:09.936: E/AndroidRuntime(1094):     ... 30 more
  03-26 05:48:14.426: I/Process(1094): Sending signal. PID: 1094 SIG: 9
  03-26 05:48:15.578: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:15.578: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:15.656: I/System.out(1203): you are in on create in main activity
  03-26 05:48:16.306: D/dalvikvm(1203): GC_FOR_ALLOC freed 74K, 7% free 2616K/2812K, paused 51ms, total 53ms
  03-26 05:48:16.576: D/dalvikvm(1203): GC_CONCURRENT freed 2K, 6% free 3025K/3200K, paused 111ms+102ms, total 262ms
  03-26 05:48:16.736: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:16.736: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:16.746: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:16.776: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:16.966: D/libEGL(1203): loaded /system/lib/egl/libEGL_emulation.so
  03-26 05:48:17.056: D/(1203): HostConnection::get() New Host Connection established 0x2a187918, tid 1203
  03-26 05:48:17.376: D/libEGL(1203): loaded /system/lib/egl/libGLESv1_CM_emulation.so
  03-26 05:48:17.407: D/libEGL(1203): loaded /system/lib/egl/libGLESv2_emulation.so
  03-26 05:48:18.176: W/EGL_emulation(1203): eglSurfaceAttrib not implemented
  03-26 05:48:18.997: D/OpenGLRenderer(1203): Enabling debug mode 0
  03-26 05:48:18.997: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:19.018: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:19.026: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:19.176: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:19.186: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:19.218: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:19.218: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:19.226: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:19.226: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:19.226: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0  
  03-26 05:48:19.436: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:19.436: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  03-26 05:48:19.436: W/Trace(1203): Unexpected value from nativeGetEnabledTags: 0
  </code></pre>
  
  <p>By clicking on package name related error in Logcat, It show me these error.</p>
  
  <p>First in MainActivity1.java<br>
      <code>View rootView = inflater.inflate(R.layout.map, container, false);</code></p>
  
  <p>Second in Topratedfragment.java<br>
      <code>viewPager.setCurrentItem(tab.getPosition());</code></p>
  
  <p>This is MainActivity1.java file</p>
  
  <pre><code>package com.example.image_changer;
  
  import android.app.ActionBar;
  import android.app.ActionBar.Tab;
  import android.app.FragmentTransaction;
  import android.graphics.Color;
  import android.graphics.drawable.ColorDrawable;
  import android.os.Bundle;
  import android.support.v4.app.FragmentActivity;
  import android.support.v4.view.ViewPager;
  import android.view.Window;
  import android.view.WindowManager;
  
  public class MainActivity1 extends FragmentActivity implements
      ActionBar.TabListener {
  
  private ViewPager viewPager;
  private TabsPagerAdapter mAdapter;
  private ActionBar actionBar;
  // Tab titles
  private String[] tabs = { "Map", "Games", "Image flipper" };
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      //this.requestWindowFeature(Window.FEATURE_NO_TITLE);
      setContentView(R.layout.activity_main1);
          /*MainActivity1.this.getWindow().setFlags(
                  WindowManager.LayoutParams.FLAG_FULLSCREEN,
                  WindowManager.LayoutParams.FLAG_FULLSCREEN);*/
      getActionBar().setBackgroundDrawable(
              new ColorDrawable(Color.parseColor("#ee7b35")));
  
  
      System.out.println("you are in oncreate in mainactivity1");
  
      // Initilization
      viewPager = (ViewPager) findViewById(R.id.pager);
      actionBar = getActionBar();
      mAdapter = new TabsPagerAdapter(getSupportFragmentManager());
  
      viewPager.setAdapter(mAdapter);
      actionBar.setHomeButtonEnabled(false);
      actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  
      // Adding Tabs
      for (String tab_name : tabs) {
          actionBar.addTab(actionBar.newTab().setText(tab_name)
                  .setTabListener(this));
      }
  
      /**
       * on swiping the viewpager make respective tab selected
       * */
      viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
  
          @Override
          public void onPageSelected(int position) {
              // on changing the page
              // make respected tab selected
              actionBar.setSelectedNavigationItem(position);
          }
  
          @Override
          public void onPageScrolled(int arg0, float arg1, int arg2) {
          }
  
          @Override
          public void onPageScrollStateChanged(int arg0) {
          }
      });
  }
  
  @Override
  public void onTabReselected(Tab tab, FragmentTransaction ft) {
  }
  
  @Override
  public void onTabSelected(Tab tab, FragmentTransaction ft) {
      // on tab selected
      // show respected fragment view
      viewPager.setCurrentItem(tab.getPosition());
      System.out.println("you are in onTabreselected");
  }
  
  @Override
  public void onTabUnselected(Tab tab, FragmentTransaction ft) {
      System.out.println("you are in onTabunselected");
  }
  
  }
  </code></pre>
  
  <p>This is my TopRatedfragment.java file</p>
  
  <pre><code>package com.example.image_changer;
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  
  public class TopRatedFragment extends Fragment {
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
  
      View rootView = inflater.inflate(R.layout.map, container, false);
  
      return rootView;
  }
  }
  </code></pre>
  
  <p>I tried this solution-
  <br></p>
  
  <p>When I change <code>extends</code> <code>Fragment</code> to <code>FragmentActivity</code> in Topratedfragment.java then it give me error- <code>The method onCreateView(LayoutInflater, ViewGroup, Bundle) of type TopRatedFragment must override or implement a supertype method</code>. <code>Remove override notation</code> as quick fix. 
  <br>When I remove override notation it give a error in Tabspageradapter.java class and error says - Type mismatch: cannot convert from TopRatedFragment to Fragment and change method return type to <code>TopRatedFragment</code> and may be this is not useful to me.</p>
  
  <p><br></p>
  
  <pre><code>package com.example.image_changer;
  
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.FragmentPagerAdapter;
  
  public class TabsPagerAdapter extends FragmentPagerAdapter {
  
  public TabsPagerAdapter(FragmentManager fm){
   super(fm);
  }
  
  @Override
  public Fragment getItem(int index) {
      // TODO Auto-generated method stub
      switch (index) {
      case 0:
          return new TopRatedFragment();
  
  
      case 1: 
          return new GamesFragment();
  
      case 2:
          return new MoviesFragment();
  
      }
  
      return null;
  }
  
  @Override
  public int getCount() {
      // TODO Auto-generated method stub
      return 3;
  }
  }
  </code></pre>
  
  <p><br><br>
  This is GameFragment.java class</p>
  
  <pre><code>package com.example.image_changer;
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  
  public class GamesFragment extends Fragment {
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      //return super.onCreateView(inflater, container, savedInstanceState);
      View rootView = inflater.inflate(R.layout.fragment_games,container,false );
  
  
      return rootView;
  }
  
  
  }
  </code></pre>
  
  <p><Br><br>Then how to solve this problem. Thanks for your help</p>