title: How restart Fragment in my Activity - Android
body: <p>I have an activity that have 3 fragment inside. I need restart a first fragment in my activity with click on Button.</p>
  
  <pre><code>ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
  adapter.addFrag(new HomeFragment(), "Home");
  adapter.addFrag(new CategoryFragment(), "Category");
  adapter.addFrag(new FilterFragment(), "Filter");
  viewPager.setAdapter(adapter);
  </code></pre>
  
  <p>I test the following way but doesn't work and show error:
  <a href="https://stackoverflow.com/questions/20702333/refresh-fragment-at-reload">refresh fragment at reload</a></p>
  
  <pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v4.app.Fragment.setNextAnim(int)' on a null object reference 
  </code></pre>