title: Error in SherlockFragment when switching items in slide Menu
body: <p>I'm having lot of problems when implementing ActionBar Sherlock, the last one is this one. I have an Slide Menu whith 3 options in my ActionBar. My problem is that when I choose one item (it load a fragment) that has been previously selected the app crash. The log error is </p>
  
  <blockquote>
    <p>The specified child already has a parent. You must call removeView()
    on the child's parent first.</p>
  </blockquote>
  
  <p>It mark a line where I add view to a HorizontalScroller. </p>
  
  <pre><code>lls.addView(mviews.get(i));
  </code></pre>
  
  <p>In my OnCreateView I have </p>
  
  <pre><code>final View v = inflater.inflate(R.layout.activity_landing, container,false);
  </code></pre>
  
  <p><code>container.removeAllViews();</code></p>
  
  <p>I haved tried many different ways posted here, but I don't get thw solution to my problem. Any ideas? </p>
  
  <p>EDIT:
  Here is some code of my MainActivity and Fragment.</p>
  
  <p>This is the MainActivity. Ther's a ScreenSplash after and a class that extends from Application that control all WebService communications.</p>
  
  <pre><code>public class MainActivity extends SherlockFragmentActivity  {
  
  
      //Declare Variables
      //...
       Fragment fragment1 = new Fragment1();
       Fragment fragment2 = new Fragment2();
       Fragment fragment3 = new Fragment3();
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                  WindowManager.LayoutParams.FLAG_FULLSCREEN);
          getSupportActionBar().setIcon(R.drawable.ic_launcher);
          getSupportActionBar().setTitle("");          
          setContentView(R.layout.drawer_main);
  
  
          // Generate title
          title = new String[] { "Item 1", "Item 2", "Item 3", "Item 4" };
  
          // Generate icon
          icon = new int[] { R.drawable.item1, R.drawable.item2,
                  R.drawable.item3, R.drawable.item4};
  
          // Locate DrawerLayout in drawer_main.xml
          mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
  
          // Locate ListView in drawer_main.xml
          mDrawerList = (ListView) findViewById(R.id.left_drawer);
  
          // Set a custom shadow that overlays the main content when the drawer
          // opens
          mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow,
                  GravityCompat.START);
  
          // Pass results to MenuListAdapter Class
          mMenuAdapter = new MenuListAdapter(this, title, subtitle, icon);
  
          // Set the MenuListAdapter to the ListView
          mDrawerList.setAdapter(mMenuAdapter);
  
          // Capture button clicks on side menu
          mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
  
          // Enable ActionBar app icon to behave as action to toggle nav drawer
          getSupportActionBar().setHomeButtonEnabled(true);
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  
          // ActionBarDrawerToggle ties together the the proper interactions
          // between the sliding drawer and the action bar app icon
          mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
                  R.drawable.ic_drawer, R.string.drawer_open,
                  R.string.drawer_close) {
  
              public void onDrawerClosed(View view) {
                  // TODO Auto-generated method stub
                  super.onDrawerClosed(view);
              }
  
              public void onDrawerOpened(View drawerView) {
                  // TODO Auto-generated method stub
                  super.onDrawerOpened(drawerView);
              }
          };
  
          mDrawerLayout.setDrawerListener(mDrawerToggle);
  
          if (savedInstanceState == null) {
              selectItem(0);
          }
  
  
  
      }
  
  
      //FOR ABS y ND
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getSupportMenuInflater().inflate(R.menu.activity_main, menu);
        //Define ActionBar buttons and actions 
  
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          //Sliding lateral Menu
          if (item.getItemId() == android.R.id.home) {
  
              if (mDrawerLayout.isDrawerOpen(mDrawerList)) {
                  mDrawerLayout.closeDrawer(mDrawerList);
              } else {
                  mDrawerLayout.openDrawer(mDrawerList);
              }
          }
  
          return super.onOptionsItemSelected(item);
      }
  
      // The click listener for ListView in the navigation drawer
      private class DrawerItemClickListener implements
              ListView.OnItemClickListener {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position,
                  long id) {
              selectItem(position);
          }
      }
  
      private void selectItem(int position) {
  
          FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
          // Locate Position
          switch (position) {
          case 0:
              ft.replace(R.id.content_frame, fragment1);
              break;
          case 1:
              ft.replace(R.id.content_frame, fragment2);
              break;
          case 2:
              ft.replace(R.id.content_frame, fragment3);
              break;
          }
          ft.commit();
          mDrawerList.setItemChecked(position, true);
          // Close drawer
          mDrawerLayout.closeDrawer(mDrawerList);
      }
  
      @Override
      protected void onPostCreate(Bundle savedInstanceState) {
          super.onPostCreate(savedInstanceState);
          // Sync the toggle state after onRestoreInstanceState has occurred.
          mDrawerToggle.syncState();
      }
  
      @Override
      public void onConfigurationChanged(Configuration newConfig) {
          super.onConfigurationChanged(newConfig);
          // Pass any configuration change to the drawer toggles
          mDrawerToggle.onConfigurationChanged(newConfig);
      }
  
  }
  </code></pre>
  
  <p>This is the fragment with error. Now the other two are empty.</p>
  
  <pre><code>public class Fragment1 extends SherlockFragment implements
      AdapterView.OnItemClickListener {
  
  //DeclareVariables
  
  public Fragment1() {
  }
  
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      //some declaration ad settings (witdhs, typefaces, caches,...)   
  
  }
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
  
  
      final View v = inflater.inflate(R.layout.main_activity, null,
              false);
      container.removeAllViews();
      lls = (LinearLayout) v.findViewById(R.id.lscroll_item);
      lls.removeAllViews();
              //Instantiate some elements of the view such as TextViews and ImageViews
              //layoutParams
  
      // Show Scroll 
      DataStore.sharedInstance().getInfo(
              new DataStore.infoReturn() {
  
          @Override
          public void call(final ArrayList&lt;User&gt; users, int error) {
              if(users != null){                  
  
                  for (i = 0; i &lt; users.size(); i++) {
  
                              mviews.add((RelativeLayout) getActivity().getLayoutInflater().inflate(R.layout.item_user, null));
                              mviews.get(i).setLayoutParams(layoutParams2);
                              imv = (ImageView) mviews.get(i).findViewById(R.id.user);
                              imv.getLayoutParams().height=friend_height;
                              imv_click = (ImageView) mviews.get(i).findViewById(R.id.click);
                              TextView text2 = (TextView) mviews.get(i).findViewById(R.id.fav);
                              text2.setTypeface(myTypeFace);
                                                              //set widths and layoutParams and sources
  
  
  
                              mviews.get(i).setId(i);
                                                              //NEXT LINE IS THE CRASH POINT, WHERE I TRY TO ADD ITEMS TO THE VIEW
                              lls.addView(mviews.get(i));
  
                              mviews.get(i).setOnClickListener(
                                      new OnClickListener() {
  
                                          @Override
                                          public void onClick(View v) {
                                              //Set actins when click
                                          }
                                      });
  
                          }
              }else{
  
                  switch (error) {
                  case -1: //ERROR OBTENER USERS                      
                      break;
  
                  default:
                      break;
                  }
  
              }
                  }
              });
  
  
  
  @Override
  public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) {
      // actions when click
  
  }
  
   @Override
      public void onResume() {
          super.onResume();
  
          refreshInfo();
              refreshSelectedUsers();
      }
  
      @Override
      public void onPause() {
          super.onPause();
          DataStore.sharedInstance().setSelectedUsers(mSelected);
  
      }
  
      @Override
      public void onDestroy() {
          super.onDestroy();
  
          //delete cache
  
      }
  
  
  
     //Some other methods for other UI items. 
  </code></pre>
  
  <p>}</p>
  
  <p>I have hidden some code to make it easier to read. </p>