title: Android Recycler View in tab layout
body: <p>I'm trying to set up a tablayout with 3 tabs, each tab will have a recycler view in it. I found this question: <a href="https://stackoverflow.com/questions/34579614/how-to-implement-recyclerview-in-a-fragment-with-tablayout">How to implement RecyclerView with CardView rows in a Fragment with TabLayout</a>
  Which is similier to what I want, I'm trying to set this up, then I'll set up my data retrieval after I get this working.</p>
  
  <p>The problem I'm getting now it setting up the PagerAdapter. Here is my code:</p>
  
  <pre><code>public class WorkoutDaysActivity extends BaseActivity{
  
  ListView mListView = new ListView(this);
  ArrayList&lt;CustomObject&gt; w29w1m;
  CustomListViewAdapter mCustomListViewAdapter;
  
  
  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.workout_days);
      mToolBar = activateToolbar();
      setUpNavigationDrawer();
  
      // Get the ViewPager and set it's PagerAdapter so that it can display items
      ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
      PagerAdapter pagerAdapter =
              new PagerAdapter(getSupportFragmentManager(), WorkoutDaysActivity.this)
  
      viewPager.setAdapter(pagerAdapter);
  
      // Give the TabLayout the ViewPager
      TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
      tabLayout.setupWithViewPager(viewPager);
  
      // Iterate over all tabs and set the custom view
      for (int i = 0; i &lt; tabLayout.getTabCount(); i++) {
          TabLayout.Tab tab = tabLayout.getTabAt(i);
          tab.setCustomView(pagerAdapter.getTabView(i));
      }
  
  }
  
  
  @Override
  public void onResume() {
      super.onResume();
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
  
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      int id = item.getItemId();
  
      if (id == R.id.action_settings) {
          return true;
      }
  
      return super.onOptionsItemSelected(item);
  }
  
  class PagerAdapter extends FragmentPagerAdapter {
  
      String tabTitles[] = new String[] { "Tab One", "Tab Two", "Tab Three" };
      Context context;
  
      public PagerAdapter(FragmentPagerAdapter fm, Context context) {
          super(fm);
          this.context = context;
      }
  
      @Override
      public int getCount() {
          return tabTitles.length;
      }
  
      @Override
      public Fragment getItem(int position) {
  
          switch (position) {
              case 0:
                  return new WorkoutDetailFragment();
              case 1:
                  return new WorkoutDetailFragment();
              case 2:
                  return new WorkoutDetailFragment();
          }
  
          return null;
      }
  
      @Override
      public CharSequence getPageTitle(int position) {
          // Generate title based on item position
          return tabTitles[position];
      }
  
      public View getTabView(int position) {
          View tab = LayoutInflater.from(WorkoutDaysActivity.this).inflate(R.layout.custom_tab, null);
          TextView tv = (TextView) tab.findViewById(R.id.custom_text);
          tv.setText(tabTitles[position]);
          return tab;
      }
  
  }}
  </code></pre>
  
  <p>The first spot where I'm getting an error is </p>
  
  <pre><code>PagerAdapter pagerAdapter =
              new PagerAdapter(getSupportFragmentManager(), WorkoutDaysActivity.this)
  
      viewPager.setAdapter(pagerAdapter);
  </code></pre>
  
  <p>The error is:</p>
  
  <pre><code> PagerAdapter (android.support.v4.app.FragmentPagerAdapter, Context) in PagerAdapter cannot be applied to: (android.support.v4.app.FragmentManager, WorkoutDaysActivity.this) 
  </code></pre>
  
  <p>The android.support.v4.app.FragmentManager is the part underlined in red. The second error is in this part:</p>
  
  <pre><code>class PagerAdapter extends FragmentPagerAdapter {
  
      String tabTitles[] = new String[] { "Tab One", "Tab Two", "Tab Three" };
      Context context;
  
      public PagerAdapter(FragmentPagerAdapter fm, Context context) {
          super(fm);
          this.context = context;
      }
  </code></pre>
  
  <p>The error is in the super(fm); part, and it states: </p>
  
  <pre><code>FragmentPagerAdapter (android.support.v4.app.FragmentManager) in FragmentPagerAdapter cannot be applied to: android.support.v4.app.FragmentPagerAdapter
  </code></pre>
  
  <p>I feel like this would be a simple error with importing the wrong thing, but my attempts to fix it failed. Any help greatly appreciated thank you!</p>