title: RecyclerView not populating data in ViewPager tab
body: <p>I have implemented a basic setup of ViewPager, RecyclerView, and ContentProvider. I seem to be able to query data without any problem but I am not able to show the content using RecyclerView in the ViewPager tab.</p>
  
  <p>Full code is available here - <a href="https://github.com/sudhirkhanger/PopularMovies" rel="nofollow">https://github.com/sudhirkhanger/PopularMovies</a></p>
  
  <pre><code>public class FavoriteFragment extends Fragment {
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          View rootView = inflater.inflate(R.layout.fragment_movie_list, container, false);
  
          // Set column size to 2 for default and portrait
          // and 3 for landscape orientations
          int column = Integer.parseInt(getString(R.string.grid_portrait));
          if (getResources().getConfiguration().orientation == 1) {
              column = Integer.parseInt(getString(R.string.grid_portrait));
          } else if (getResources().getConfiguration().orientation == 2) {
              column = Integer.parseInt(getString(R.string.grid_landscape));
          }
  
          mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
          mRecyclerView.setHasFixedSize(true);
          mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), column));
  
          ArrayList&lt;Movie&gt; mMovieArrayList = new ArrayList&lt;Movie&gt;();
  
          ContentResolver resolver = getActivity().getContentResolver();
  
          Cursor cursor =
                  resolver.query(MovieContract.MovieEntry.CONTENT_URI,
                          null,
                          null,
                          null,
                          null);
  
          if (cursor != null) {
              if (cursor.moveToFirst()) {
                  do {
                      String title = cursor.getString(cursor.getColumnIndex(MovieContract.MovieEntry.TITLE));
                      String movie_id = cursor.getString(cursor.getColumnIndex(MovieContract.MovieEntry.MOVIE_ID));
                      String poster = cursor.getString(cursor.getColumnIndex(MovieContract.MovieEntry.POSTER));
                      String backdrop = cursor.getString(cursor.getColumnIndex(MovieContract.MovieEntry.BACKDROP));
                      String overview = cursor.getString(cursor.getColumnIndex(MovieContract.MovieEntry.OVERVIEW));
                      String vote_average = cursor.getString(cursor.getColumnIndex(MovieContract.MovieEntry.VOTE_AVERAGE));
                      String release_date = cursor.getString(cursor.getColumnIndex(MovieContract.MovieEntry.DATE));
  
                      Movie movie = new Movie(title, release_date, poster,
                              vote_average, overview, backdrop, movie_id);
                      mMovieArrayList.add(movie);
                  } while (cursor.moveToNext());
              }
          }
  
          if (cursor != null)
              cursor.close();
  
          for (Movie movie : mMovieArrayList) {
              Log.d("FavoriteFragment List", movie.getTitle());
          }
  
          mMovieAdapter = new MovieAdapter(getActivity(), mMovieArrayList);
          mMovieAdapter.notifyDataSetChanged();
          mRecyclerView.setAdapter(mMovieAdapter);
          return rootView;
      }
  
      public static FavoriteFragment newInstance() {
          Bundle args = new Bundle();
          FavoriteFragment fragment = new FavoriteFragment();
          fragment.setArguments(args);
          return fragment;
      }
  
      @Override
      public void onResume() {
          super.onResume();
          mRecyclerView.setAdapter(mMovieAdapter);
          mMovieAdapter.notifyDataSetChanged();
      }
  
      RecyclerView mRecyclerView;
      MovieAdapter mMovieAdapter;
  }
  </code></pre>
  
  <p>As you can see below that ArrayList contains the data.</p>
  
  <pre><code>04-25 22:02:36.216 4718-4718/com.sudhirkhanger.app.popularmoviesstageone W/FragmentManager: moveToState: Fragment state for PopularFragment{d7cf0b6 #1 id=0x7f0c006b} not updated inline; expected state 3 found 2
  04-25 22:02:37.757 4718-4718/com.sudhirkhanger.app.popularmoviesstageone D/FavoriteFragment List: Whiplash
  04-25 22:02:37.757 4718-4718/com.sudhirkhanger.app.popularmoviesstageone D/FavoriteFragment List: Batman v Superman: Dawn of Justice
  04-25 22:02:37.757 4718-4718/com.sudhirkhanger.app.popularmoviesstageone D/FavoriteFragment List: Star Wars: The Force Awakens
  04-25 22:02:37.757 4718-4718/com.sudhirkhanger.app.popularmoviesstageone D/FavoriteFragment List: The Shawshank Redemption
  04-25 22:02:37.757 4718-4718/com.sudhirkhanger.app.popularmoviesstageone D/FavoriteFragment List: The Godfather
  04-25 22:02:37.757 4718-4718/com.sudhirkhanger.app.popularmoviesstageone D/FavoriteFragment List: Interstellar
  04-25 22:02:37.757 4718-4718/com.sudhirkhanger.app.popularmoviesstageone D/FavoriteFragment List: Captain America: Civil War
  04-25 22:02:37.757 4718-4718/com.sudhirkhanger.app.popularmoviesstageone D/FavoriteFragment List: The Jungle Book
  04-25 22:02:37.757 4718-4718/com.sudhirkhanger.app.popularmoviesstageone D/FavoriteFragment List: The Revenant
  04-25 22:02:37.757 4718-4718/com.sudhirkhanger.app.popularmoviesstageone D/FavoriteFragment List: Jurassic World
  04-25 22:02:37.757 4718-4718/com.sudhirkhanger.app.popularmoviesstageone D/FavoriteFragment List: Mad Max: Fury Road
  </code></pre>