title: Null object reference on LayoutManager
body: <p>I am getting this error when trying to set my layoutmanager for my recyclerview. I have created a layout manager and set my recyclerview to use it. For some reason the layoumanager is null. </p>
  
  <pre><code>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jcaseydev.popularmovies/com.jcaseydev.popularmovies.ui.ReviewsActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' on a null object reference
                                                                             at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2625)
                                                                             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2686)
                                                                             at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
                                                                             at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                             at android.os.Looper.loop(Looper.java:154)
                                                                             at android.app.ActivityThread.main(ActivityThread.java:5969)
                                                                             at java.lang.reflect.Method.invoke(Native Method)
                                                                             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:801)
                                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:691)
                                                                          Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' on a null object reference
                                                                             at com.jcaseydev.popularmovies.ui.ReviewsFragment.onCreateView(ReviewsFragment.java:65)
                                                                             at android.support.v4.app.Fragment.performCreateView(Fragment.java:2074)
                                                                             at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
                                                                             at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1286)
                                                                             at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:758)
                                                                             at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1671)
                                                                             at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388)
                                                                             at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:619)
                                                                             at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1248)
                                                                             at android.app.Activity.performStart(Activity.java:6686)
                                                                             at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2588)
                                                                             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2686) 
                                                                             at android.app.ActivityThread.-wrap12(ActivityThread.java) 
                                                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440) 
                                                                             at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                             at android.os.Looper.loop(Looper.java:154) 
                                                                             at android.app.ActivityThread.main(ActivityThread.java:5969) 
                                                                             at java.lang.reflect.Method.invoke(Native Method)
  </code></pre>
  
  <p>Here is the recylerview class.</p>
  
  <pre><code>   public ReviewsFragment(){}
  RecyclerView mRecyclerView;
  RecyclerView.LayoutManager linearLayoutManager;
  RecyclerView.Adapter mAdapter;
  private int movieId;
  private List&lt;Reviews&gt; movieReviews = new ArrayList&lt;&gt;();
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      View rootView = inflater.inflate(R.layout.activity_review, container, false);
  
      FetchMovieReviews fmr = new FetchMovieReviews();
     // fmr.execute();
  
      //get intent
      Intent intent = getActivity().getIntent();
  
      //key for the intent extra
      String MOVIE_ID = "movie_id";
      if(intent != null &amp;&amp; intent.hasExtra(MOVIE_ID)){
         movieId = intent.getIntExtra(MOVIE_ID, 49026);
      }
  
      mRecyclerView = (RecyclerView) rootView.findViewById(R.id.reviews_recyclerview);
      linearLayoutManager = new LinearLayoutManager(getActivity());
      mRecyclerView.setLayoutManager(linearLayoutManager);
  
      movieReviews.add(0, new Reviews("test", "TESTING"));
      movieReviews.add(1, new Reviews("test", "TESTING"));
      movieReviews.add(2, new Reviews("tset", "TESTING"));
  
      mAdapter = new MyAdapter(movieReviews);
      mRecyclerView.setAdapter(mAdapter);
      return rootView;
  }
  
  @Override
  public void onAttach(Context context) {
      super.onAttach(context);
  
  
  
  }
  
  public class MyAdapter extends RecyclerView.Adapter&lt;MyAdapter.ViewHolder&gt;{
      private List&lt;Reviews&gt; mDataset;
  
      public class ViewHolder extends RecyclerView.ViewHolder{
          public TextView mTextView;
          public ViewHolder(View itemView) {
              super(itemView);
              mTextView = (TextView) itemView;
          }
      }
  
      public MyAdapter(List&lt;Reviews&gt; reviews){
          mDataset = reviews;
      }
  
      @Override
      public MyAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.review_list_item, parent, false);
  
          ViewHolder vh = new ViewHolder(view);
          return vh;
      }
  
      @Override
      public void onBindViewHolder(MyAdapter.ViewHolder holder, int position) {
          holder.mTextView.setText(mDataset.get(position).getAuthor());
      }
  
      @Override
      public int getItemCount() {
          return mDataset.size();
      }
  }
  </code></pre>
  
  <p>I'm not sure what the problem could be.</p>
  
  <p>Here is the review_fragment xml</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
  
  &lt;android.support.v7.widget.RecyclerView
      android:layout_height="match_parent"
      android:layout_width="match_parent"
      android:id="@+id/reviews_recyclerview"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Here is the activity_review xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;FrameLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/review_activity"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  &lt;/FrameLayout&gt;
  </code></pre>