title: I am trying to add dynamic title in tablayout but on basis of that title i want to display different products
body: <p><a href="https://i.stack.imgur.com/m3Dky.png" rel="nofollow noreferrer">enter image description here</a>     for (int i = 0; i &lt; mFragmentTitleList.size(); i++) {
             mFragmentList.add(new MenuListFragment());
              }</p>
  
  <p><strong>Problem is when i select or swipe tab it will display products of previous tab.
  suppose i have 5 tabs when i click or select 4th tab it will call 3rd tab or 2nd tab's products.</strong> </p>
  
  <pre><code>  class ViewPagerAdapter extends FragmentPagerAdapter {
          private List&lt;android.support.v4.app.Fragment&gt; mFragmentList = new ArrayList&lt;&gt;();
          private List&lt;String&gt; mFragmentTitleList = new ArrayList&lt;&gt;();
  
          public ViewPagerAdapter(FragmentManager fm, List&lt;android.support.v4.app.Fragment&gt; fragments, List&lt;String&gt; titleLists) {
              super(fm);
              this.mFragmentList = fragments;
              this.mFragmentTitleList = titleLists;
          }
  
          @Override
          public android.support.v4.app.Fragment getItem(int position) {
              return mFragmentList.get(position);
          }
  
          @Override
          public int getCount() {
              return mFragmentList == null ? 0 : mFragmentList.size();
          }
  
          @Override
          public CharSequence getPageTitle(int position) {
              return mFragmentTitleList.get(position);
          }
      }
  
     public void onTabSelected(TabLayout.Tab tab) {
                  menutitle = tab.getText().toString();}
  </code></pre>
  
  <p>in my api call i pass this title</p>
  
  <pre><code>if(child_menu_arrayJSONObject.getString("name").equals(CommonDetailFragment.menutitle))
  </code></pre>