title: Android: RecyclerView: No adapter attached; skipping layout
body: <p>I keep getting the error <strong>"RecyclerView: No adapter attached; skipping layout"</strong> when the RecyclerView list is shown. I have 3 tabs and one tab has a RecyclerView list that is populated from SQLite database. I don't get any crashes and the data is shown correctly in the view but I still get this error. </p>
  
  <p>I thought it was just a warning because the data is in place correctly but when I tried onClick it doesn't work and I'm sure it has something to do with this error.</p>
  
  <p>I know this question has been asked a lot before but I checked most of the questions and none has worked for me. </p>
  
  <p><strong>This is my fragment:</strong></p>
  
  <pre><code>public class RecentsFragment extends Fragment {
      DatabaseHelper helper;
      List&lt;MyPojo&gt; dbList;
      RecyclerView mRecyclerView;
      private MyGridAdapter mAdapter;
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
          final View view = inflater.inflate(R.layout.my_recents_list, container, false);
          mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
          mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
          mRecyclerView.setHasFixedSize(true);
          return view;
      }
      @Override
      public void onViewCreated(View view, Bundle savedInstanceState) {
          super.onViewCreated(view, savedInstanceState);
  
          setHasOptionsMenu(true);
          dbList = new ArrayList&lt;MyPojo&gt;();
  
          dbList = getCat(); // getCat returns array list from sqlite database
  
          mAdapter = new MyGridAdapter(dbList);
          mRecyclerView.setAdapter(mAdapter);
  
      }
  }
  </code></pre>
  
  <p><strong>My adapter:</strong></p>
  
  <pre><code>public class MyGridAdapter extends RecyclerView.Adapter&lt;MyGridAdapter.ViewHolder&gt; {
  
      static List&lt;MyPojo&gt; dbList;
      static Context context;
  
      MyGridAdapter(Context context, List&lt;MyPojo&gt; dbList){
          this.dbList = new ArrayList&lt;MyPojo&gt;();
          this.context = context;
          this.dbList = dbList;
  
      }
  
  
      MyGridAdapter(List&lt;MyPojo&gt; dbList){
          this.dbList = new ArrayList&lt;MyPojo&gt;();
          this.dbList = dbList;
  
      }
  
      @Override
      public MyGridAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  
          View itemLayoutView = LayoutInflater.from(parent.getContext()).inflate(
                  R.layout.categories_item, null);
  
          ViewHolder viewHolder = new ViewHolder(itemLayoutView);
          return viewHolder;
      }
  
      @Override
      public void onBindViewHolder(final MyGridAdapter.ViewHolder holder, int position) {
  
          holder.title.setText(dbList.get(position).getCat());
      }
  
      @Override
      public int getItemCount() {
          return dbList.size();
      }
  
      public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
  
          public TextView title;
          public LinearLayout placeHolder;
          ImageView image;
  
          public ViewHolder(View itemLayoutView) {
              super(itemLayoutView);
              title = (TextView) itemLayoutView.findViewById(R.id.placeName);
  
          }
  
          @Override
          public void onClick(View v) {
              Intent intent = new Intent(context, DetailsActivity.class);
  
              Bundle extras = new Bundle();
              extras.putInt("catid", dbList.get(getAdapterPosition()).getCatid());
              intent.putExtras(extras);
  
              context.startActivity(intent);
  
          }
      }
  }
  </code></pre>
  
  <p>Thanks in advance</p>
  
  <p><strong>Update: my_recents_list.xml</strong></p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      tools:context=".RecentsFragment"&gt;
  
  
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/recyclerView"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="#f8f8f8"
          android:divider="@null"
          android:listSelector="@android:color/transparent"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>