title: How to refresh a Fragment of a FragmentPagerAdapter?
body: <p>I have got 2 tabs called tab1 (home) and tab2 (profile) using <code>TabPageIndicator</code> and <code>FragmentPagerAdapter</code> libraries.</p>
  
  <p>In tab2, I have a button named "Log in" (tab2 inflates <code>abc.xml</code>).</p>
  
  <p>When users click "log in" button, the app will show a login form in a new activity.
  After logging in, the activity finishes and the content view of tab2 will change ( it shows user's profile because it will inflate <code>xyz.xml</code>). How can I do that?</p>
  
  <pre><code>public class MainActivity extends SherlockFragmentActivity {
      private static String[] TAB_NAMES = null;
      private Context context = this;
      private static FragmentPagerAdapter adapter ;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
  
          if (TAB_NAMES == null) {
              TAB_NAMES = new String[] {
                      getResources().getString(R.string.tab_home),
                      getResources().getString(R.string.tab_profile) };
          }
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          adapter = new TabsAdapter(
                  getSupportFragmentManager());
  
          ViewPager pager = (ViewPager) findViewById(R.id.pager);
  
          pager.setAdapter(adapter);
  
  
          TabPageIndicator indicator = (TabPageIndicator) findViewById(R.id.indicator);
          indicator.setViewPager(pager);
  
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          MenuInflater infalter = getSupportMenuInflater();
          infalter.inflate(R.menu.main_menu, menu);
          return true;
      }
  
      class TabsAdapter extends FragmentPagerAdapter {
          public TabsAdapter(FragmentManager fm) {
              super(fm);
          }
  
          @Override
          public Fragment getItem(int position) {
              switch (position) {
              case 0:
                  return HomeFragment.getInstance();
              case 1:
                  return new ProfileFragment();
  
              default:
                  return HomeFragment.getInstance();
              }
          }
          }
  </code></pre>