title: Update data to tab Fragment Android when swipe
body: <p>I have a problem with my code, and i try fix it by search google but not work. 
  I try writing a karaoke List App to view list songs and favorite songs.This app have 2 Fragment Tab, List and Favorite, I want that when user click add Favorite in List Tab or Favorite tab, favorite tab will be updated immediately. But it not work. I must restart my app to view result. I try to refresh Favorite tab by getItem but it not work. </p>
  
  <p>Here is my code, please help me, thanks very much.
  Main Activity:</p>
  
  <pre><code>private void setupViewPager(ViewPager viewPager) {
      ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
  
      adapter.addFrag(new DanhSach(), "  ZANHSÁCH");
      adapter.addFrag(new YeuThich(), "  YÊUTHÍCH");
      adapter.addFrag(new LienHe(), "  LIÊNHỆ");
      viewPager.setOffscreenPageLimit(0);
       viewPager.setAdapter(adapter);
  }
  class ViewPagerAdapter extends FragmentPagerAdapter {
      private final List&lt;Fragment&gt; mFragmentList = new ArrayList&lt;&gt;();
      private final List&lt;String&gt; mFragmentTitleList = new ArrayList&lt;&gt;();
  
      public ViewPagerAdapter(FragmentManager manager) {
          super(manager);
      }
      @Override
      public int getItemPosition(Object object) {
  
              return super.getItemPosition(object);
      }
  
      @Override
      public Fragment getItem(int position) {
         return mFragmentList.get(position);
      }
  
      @Override
      public int getCount() {
          return mFragmentList.size();
      }
  
      public void addFrag(Fragment fragment, String title) {
          mFragmentList.add(fragment);
          mFragmentTitleList.add(title);
      }
  
      @Override
      public CharSequence getPageTitle(int position) {
          return null;
          //return mFragmentTitleList.get(position);
      }
  }
  </code></pre>
  
  <p>Favorite Class:</p>
  
  <pre><code>    @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
  }
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      // Inflate the layout for this fragment
      View view =  inflater.inflate(R.layout.yeuthich, container, false);
      ListView lvdanhsach = (ListView) view.findViewById(R.id.lvyeuthich);
      MainActivity main1 = (MainActivity) getActivity();
  
      YtAdapter = new BaiHatAdapter(getActivity(),R.layout.items,main1.dsYeuthich);
      YtAdapter.notifyDataSetChanged();
      lvdanhsach.setAdapter(YtAdapter);
  
  
      return view;
    }
  
  }
  </code></pre>