title: ViewPage Fragment disappear when reload again
body: <p>The following is layout</p>
  
  <p>test.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"&gt;
  
  &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content"
          android:text="Click"
          android:id="@+id/button"
          /&gt;
  
  &lt;!-- Framelayout to display Fragments --&gt;
  &lt;FrameLayout
          android:id="@+id/frame_container"
          android:layout_width="match_parent"
          android:layout_height="match_parent" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>test_detail.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"&gt;
  
  &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textAppearance="?android:attr/textAppearanceLarge"
          android:text="Hello"
          android:id="@+id/textView" android:layout_gravity="center_horizontal"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>common_view_pager_layout</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"&gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/MainViewerPage"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          &gt;
      &lt;android.support.v4.view.PagerTabStrip
              android:id="@+id/TitlePageTabStrip"
              android:layout_width="match_parent"
              android:layout_height="wrap_content" /&gt;
      &lt;/android.support.v4.view.ViewPager&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>The following is my Activity code</p>
  
  <pre><code>    public class TestFragmentActivity extends FragmentActivity {
      @Override
      public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      this.setContentView(R.layout.test);
  
      Button button = (Button) this.findViewById(R.id.button);
      button.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              FragmentManager fragmentManager = getSupportFragmentManager();
              fragmentManager.beginTransaction()
                      .replace(R.id.frame_container, new HomeFragment()).commit();
  
          }
      });
  
      }
  
      public class HomeFragment extends Fragment {
      private PagerAdapter _adapter;
  
      public HomeFragment() {
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
  
          View view = inflater.inflate(R.layout.common_view_pager_layout, container, false);
  
          this._adapter = new PagerAdapter(TestFragmentActivity.this);
          this._adapter.add(new DetailFragment());
  
          ViewPager pager = (ViewPager) view.findViewById(R.id.MainViewerPage);
          pager.setAdapter(this._adapter);
  
          return view;
      }
      }
  
  
      public class DetailFragment extends Fragment {
  
      public DetailFragment() {
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
  
          View rootView = inflater.inflate(R.layout.test_detail, container, false);
  
          return rootView;
      }
      }
  
  
      public class PagerAdapter extends FragmentPagerAdapter {
      private ArrayList&lt;Fragment&gt; _fragments;
  
      public PagerAdapter(FragmentActivity activity) {
          super(activity.getSupportFragmentManager());
  
          this._fragments = new ArrayList&lt;Fragment&gt;();
      }
  
      public void add(Fragment fragment) {
          this._fragments.add(fragment);
      }
  
      @Override
      public Fragment getItem(int position) {
          return this._fragments.get(position);
      }
  
      @Override
      public CharSequence getPageTitle(int position) {
          return "Test";
      }
  
      @Override
      public int getCount() {
          return 1;
      }
  
  
      }
  }
  </code></pre>
  
  <p>When I click a button the fragment in ViewPager was display
  <img src="https://i.stack.imgur.com/8ud8j.png" alt="When I click a button the fragment in ViewPager was display"></p>
  
  <p>But when I click the button again the fragment disappear
  <img src="https://i.stack.imgur.com/VFhBE.png" alt="enter image description here"></p>
  
  <p>Please help me.</p>