title: tabview with fragments in android
body: <p>Hi I am creating tabview by extending fragments in one of my tab i have a button when I click that I need to move to another screen but in same tab it is displaying next screen but along with the previous screen what should I do so that I can view only one screen in the tab this is my code below</p>
  
  <pre><code>public class Tab1Fragment extends Fragment  {
  
      LinearLayout mLayout;
  
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
  
          if (container == null) {         
                   return null;
          }
          LinearLayout theLayout = (LinearLayout)inflater.inflate(R.layout.tab_frag1_layout, container, false);
       // Register for the Button.OnClick event
  
      Button b = (Button)theLayout.findViewById(R.id.button1);
      b.setOnClickListener(new View.OnClickListener() {
  
          void onContentChanged () {}
  
                  @Override       
          public void onClick(View v) {
  
                 Fragment mFragment = new third_fragment_view();
                         android.support.v4.app.FragmentTransaction ft = getFragmentManager().beginTransaction();
                 ft.replace(R.id.container, mFragment);
                 ft.addToBackStack(null);
                 ft.commit();
                 //ft.add(R.id.container, mFragment);     
          }
      });
      return theLayout;       
     }    
  }
  </code></pre>