title: NullPointerException for RecyclerView In fragment
body: <p>Trying to implement a cards list using the recyclerview inside of a fragment. Every time I run it crashes when trying to open the fragment. I was following this tutorial <a href="https://developer.android.com/training/material/lists-cards.html#Dependencies" rel="nofollow">https://developer.android.com/training/material/lists-cards.html#Dependencies</a> and also this one <a href="http://code.tutsplus.com/tutorials/getting-started-with-recyclerview-and-cardview-on-android--cms-23465" rel="nofollow">http://code.tutsplus.com/tutorials/getting-started-with-recyclerview-and-cardview-on-android--cms-23465</a></p>
  
  <p>Logcat where it crashes.</p>
  
  <pre>
      java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setHasFixedSize(boolean)' on a null object reference
  </pre>
  
  <p>circles_tab.xml snippet</p>
  
  <pre><code>&lt;android.support.v7.widget.RecyclerView
      android:id="@+id/circleList"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginLeft="12dp"
      android:layout_marginRight="12dp"
      android:layout_marginTop="12dp"/&gt;
  </code></pre>
  
  <p>CirclesFragment</p>
  
  <pre><code>public class CirclesFragment extends Fragment {
  
  public ArrayList&lt;String&gt; circles = new ArrayList&lt;String&gt;();
  public CharSequence[] circlesList;
  public String[] circlesArray = new String[circles.size()];
  private List&lt;Person&gt; persons;
  
  
  private RecyclerView mRecyclerView;
  private RecyclerView.Adapter mAdapter;
  private RecyclerView.LayoutManager mLayoutManager;
  
  ButtonFloat FAB;
  Dialog dialog;
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      View v =inflater.inflate(R.layout.circles_tab,container,false);
  
      // Create Cards list
  
      mRecyclerView = (RecyclerView)getActivity().findViewById(R.id.circleList);
      mRecyclerView.setHasFixedSize(false);
      mLayoutManager = new LinearLayoutManager(getActivity());
      mRecyclerView.setLayoutManager(mLayoutManager);
      initializeData();
      mAdapter  = new RVAdapter(persons);
      mRecyclerView.setAdapter(mAdapter);
  
      return v;
  }
  
  private void initializeData(){
      persons = new ArrayList&lt;&gt;();
      persons.add(new Person("Peter Parker", R.drawable.logo));
      persons.add(new Person("Miles Morales",R.drawable.logo));
      persons.add(new Person("Oliver Queen", R.drawable.logo));
  }
  </code></pre>
  
  <p>There are many similar questions with this topic but most of them have not been resolved. Any help would be greatly appreciated. </p>
  
  <p>Thanks everyone </p>