title: java.lang.NullPointerException at android.support.v7.widget.RecyclerView.onMeasure
body: <p>I try to use RecyclerView with RecyclerView.Adapter but here is something wrong. I post my code below:</p>
  
  <p>Layout:</p>
  
  <pre><code>   &lt;android.support.v7.widget.RecyclerView
      xmlns:tools="http://schemas.android.com/tools"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/topic_view"
      android:scrollbars="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent" /&gt;
  </code></pre>
  
  <p>topic_tile.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="@dimen/tile_height"&gt;
  
      &lt;com.makeramen.RoundedImageView
          xmlns:app="http://schemas.android.com/apk/res-auto"
          android:id="@+id/avatar"
          android:padding="16dp"
          app:riv_corner_radius="72dp"
          android:layout_height="72dp"
          android:layout_width="72dp"
          /&gt;
  
      &lt;LinearLayout
          android:id="@+id/text_layout"
          android:orientation="vertical"
          android:paddingTop="@dimen/text_padding_top_and_bottom"
          android:paddingBottom="@dimen/text_padding_top_and_bottom"
          android:paddingRight="16dp"
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
          &lt;TextView
              android:id="@+id/title"
              android:textSize="@dimen/primary_font"
              android:paddingLeft="@dimen/text_padding_left"
              android:textColor="#000000"
              android:text="Title"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"/&gt;
          &lt;TextView
              android:id="@+id/author"
              android:textSize="@dimen/secondary_font"
              android:paddingLeft="@dimen/text_padding_left"
              android:text="author"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"/&gt;
      &lt;/LinearLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Here is in <code>onCreate()</code> </p>
  
  <pre><code>public class TitleListActivity extends ActionBarActivity {
  
      private RecyclerView topic_view;
      private RecyclerView.LayoutManager mLayoutManager;
      private TitlelistAdapter adapter;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_title_list);
  
          .....
  
          topic_view = (RecyclerView)findViewById(R.id.topic_view);
          adapter = new TitlelistAdapter(topicList);
  
          topic_view.setHasFixedSize(true);
          mLayoutManager = new LinearLayoutManager(TitleListActivity.this);
          topic_view.setLayoutManager(mLayoutManager);
          topic_view.setItemAnimator(new DefaultItemAnimator());
  
          topic_view.setAdapter(adapter);
  </code></pre>
  
  <p>the Adapter:</p>
  
  <pre><code>public class TitlelistAdapter extends RecyclerView.Adapter&lt;TitlelistAdapter.ViewHolder&gt; {
  
      public List&lt;Topic&gt; topicList;
  
      public static class ViewHolder extends RecyclerView.ViewHolder{
  
          TextView title;
          TextView author;
          RoundedImageView avatar;
  
          public ViewHolder(View itemView) {
              super(itemView);
  
              title = (TextView)itemView.findViewById(R.id.title);
              author = (TextView)itemView.findViewById(R.id.author);
              avatar = (RoundedImageView)itemView.findViewById(R.id.avatar);
          }
      }
  
      public TitlelistAdapter(List&lt;Topic&gt; topicList){
          this.topicList = topicList;
      }
  
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
  
          View itemView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.topic_tile,viewGroup,false);
          return new ViewHolder(itemView);
      }
  
      @Override
      public void onBindViewHolder(ViewHolder viewHolder, int i) {
          viewHolder.title.setText(topicList.get(i).title);
          viewHolder.author.setText(topicList.get(i).member.username);
      }
  
      @Override
      public long getItemId(int position) {
          return super.getItemId(position);
      }
  
      @Override
      public int getItemCount() {
          return topicList.size();
      }
  }
  </code></pre>
  
  <p>Here is the exception:</p>
  
  <pre><code>java.lang.NullPointerException
          at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:1694)
          at android.view.View.measure(View.java:16497)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
          at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
          at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
          at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
          at android.view.View.measure(View.java:16497)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
          at android.view.View.measure(View.java:16497)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
          at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:453)
          at android.view.View.measure(View.java:16497)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
          at android.view.View.measure(View.java:16497)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
          at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
          at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
          at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
          at android.view.View.measure(View.java:16497)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
          at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)
          at android.view.View.measure(View.java:16497)
          at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1912)
          at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1109)
          at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1291)
          at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
          at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
          at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
          at android.view.Choreographer.doCallbacks(Choreographer.java:574)
          at android.view.Choreographer.doFrame(Choreographer.java:544)
          at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
          at android.os.Handler.handleCallback(Handler.java:733)
          at android.os.Handler.dispatchMessage(Handler.java:95)
          at android.os.Looper.loop(Looper.java:136)
          at android.app.ActivityThread.main(ActivityThread.java:5001)
          at java.lang.reflect.Method.invokeNative(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:515)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
          at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Is it something I didn't init or something I should write more?</p>