title: Implementing two RecyclerViews in separate fragments, but within the same activity
body: <p>I have one working RecyclerView in the MainActivity.java and fragment "Overview" for regular events, but I'd like to implement a second one in a separate fragment ("Reminders"). In the OnCreate of my MainActivity, where the first fragment was set up, I am facing issues in terms of not being able to use setContentView twice.</p>
  
  <p>Here's my MainActivity.java:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity
          implements NavigationDrawerFragment.NavigationDrawerCallbacks {
  
      /**
       * Fragment managing the behaviors, interactions and presentation of the navigation drawer.
       */
      private NavigationDrawerFragment mNavigationDrawerFragment;
  
      /**
       * Used to store the last screen title. For use in {@link #restoreActionBar()}.
       */
      private CharSequence mTitle;
  
      private RecyclerView mRecyclerView;
      private RecyclerView.LayoutManager mLayoutManager;
      OverviewAdapter mAdapter;
  
      private RecyclerView reminderRecyclerView;
      private RecyclerView.LayoutManager reminderLayoutManager;
      RemindersAdapter reminderAdapter;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          mNavigationDrawerFragment = (NavigationDrawerFragment)
                  getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
          mTitle = getTitle();
  
          // Set up the drawer.
          mNavigationDrawerFragment.setUp(
                  R.id.navigation_drawer,
                  (DrawerLayout) findViewById(R.id.drawer_layout));
  
          mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view);
  
  
          mRecyclerView.setHasFixedSize(true);
          mLayoutManager = new LinearLayoutManager(this);
          mRecyclerView.setLayoutManager(mLayoutManager);
  
          events();
          mAdapter = new OverviewAdapter(events);
          mRecyclerView.setAdapter(mAdapter);
  
      }
  
      @Override
      public void onNavigationDrawerItemSelected(int element) {
          // update the main content by replacing fragments
          FragmentManager fragmentManager = getSupportFragmentManager();
          Fragment fragment = new Fragment();
          element++;
          // int frame = R.id.container;
  
          String position = "Overview";
          switch(element) {
  
              case 1:
                  position = "Overview";
                  mTitle = getString(R.string.title_section1);
                  // frame = R.id.container;
                  break;
  
              case 2:
                  position = "Reminders";
                  mTitle = getString(R.string.title_section2);
                  fragment = new Reminders();
  
                  setContentView(R.layout.reminder_recycler);
                  // REMINDERS RECYCLERVIEW SETUP BELOW
                  setContentView(R.layout.reminder_recycler);
                  reminderRecyclerView = (RecyclerView) findViewById(R.id.my_reminder_recycler_view);
  
                  // use this setting to improve performance if you know that changes
                  // in content do not change the layout size of the RecyclerView
                  reminderRecyclerView.setHasFixedSize(true);
  
                  reminderEvents();
                  // use a linear layout manager
                  reminderLayoutManager = new LinearLayoutManager(this);
                  reminderRecyclerView.setLayoutManager(reminderLayoutManager);
  
  
                  reminderAdapter = new RemindersAdapter(reminderEventsList);
                  reminderRecyclerView.setAdapter(reminderAdapter);
  
                  break;
  
              case 3:
                  position = "Categories";
                  mTitle = getString(R.string.title_section3);
                  fragment = new Categories();
                  // frame = R.id.categories;
                  break;
  
              case 4:
                  position = "Smart Suggestions";
                  mTitle = getString(R.string.title_section4);
                  fragment = new SmartSuggestions();
                  // frame = R.id.smart_suggestions;
                  break;
  
          }
          fragmentManager.beginTransaction()
                  .replace(R.id.container, fragment)
                  .commit();
  
      }
  }
  </code></pre>
  
  <p>I'm being given a null pointer exception within the Reminders class, shown below:</p>
  
  <pre><code>public class Reminders extends Fragment {
  
  private RecyclerView reminderRecyclerView;
  private RecyclerView.LayoutManager reminderLayoutManager;
  RemindersAdapter reminderAdapter;
  Context context;
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
  
      View rootView = inflater.inflate(R.layout.reminders, container, false);
  
      // Inflate the layout for this fragment
      return rootView;
  
  
  
  }
  
  public List&lt;ReminderEvents&gt; reminderEventsList = new ArrayList&lt;&gt;();
  public void reminderEvents() {
  
      reminderEventsList.add(new ReminderEvents("Example reminder", "Wed 12 July"));
      reminderEventsList.add(new ReminderEvents("Example reminder1", "Wed 12 July"));
      reminderEventsList.add(new ReminderEvents("Example reminder2", "Wed 12 July"));
      reminderEventsList.add(new ReminderEvents("Example reminder3", "Wed 12 July"));
  
    }
  
  }
  </code></pre>