title: Recycler View Not Showing
body: <p>I have been making an app that uses a recycler view in a navigation drawer. Why the contents of the recycler view are not showing up. The view is definitely there as I can see the scroll shadows. I am not sure what I have done wrong, as the app does not crash when it is run.</p>
  <p>Navigation Drawer Fragment:</p>
  <pre><code>public class NavigationDrawerFragment extends android.support.v4.app.Fragment {
  
      public static final String PREF_FILE_NAME = &quot;testPref&quot;;
      public static final String KEY_USER_LEARNED_DRAWER = &quot;user_learned_drawer&quot;;
      private RecyclerView mRecyclerView;
      private ActionBarDrawerToggle mDrawerToggle;
      private DrawerLayout mDrawerLayout;
      private View containerView;
      private Boolean mUserLearnedDrawer;
      private Boolean mFromSavedInstanceState;
      private DrawerAdapter adapter;
  
      public NavigationDrawerFragment() {
          mFromSavedInstanceState = false;
      }
  
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          mUserLearnedDrawer = Boolean.valueOf(readFromPreferences(getActivity(), KEY_USER_LEARNED_DRAWER, &quot;false&quot;));
          if (savedInstanceState != null){
              mFromSavedInstanceState = true;
          }
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          View layout = inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
          mRecyclerView = (RecyclerView) layout.findViewById(R.id.drawerList);
          adapter = new DrawerAdapter(getActivity(), getData());
          mRecyclerView.setAdapter(adapter);
          mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
          return layout;
      }
  
      public static List&lt;DrawerRow&gt; getData(){
          List&lt;DrawerRow&gt; data = new ArrayList&lt;&gt;();
          int icons[] = {R.drawable.ic_launcher,R.drawable.ic_launcher,R.drawable.ic_launcher,R.drawable.ic_launcher};
          String titles[] = {&quot;Link 1&quot;,&quot;Link 2&quot;,&quot;Link 3&quot;,&quot;Link 4&quot;};
          for (int i = 0 ; i &lt; titles.length &amp;&amp; i &lt; icons.length; i++){
              DrawerRow current = new DrawerRow();
              current.iconId = icons[i];
              current.title = titles[i];
              data.add(current);
          }
  
          return data;
      }
  
      public void setUp(int fragmentId, DrawerLayout drawerLayout, Toolbar toolbar) {
          containerView = getActivity().findViewById(fragmentId);
          mDrawerLayout = drawerLayout;
          mDrawerToggle = new ActionBarDrawerToggle(getActivity(), drawerLayout, toolbar, R.string.drawerOpen, R.string.drawerClosed){
  
              @Override
              public void onDrawerOpened(View drawerView) {
                  super.onDrawerOpened(drawerView);
                  if(!mUserLearnedDrawer){
                      mUserLearnedDrawer = true;
                      saveToPreferences(getActivity(),KEY_USER_LEARNED_DRAWER, mUserLearnedDrawer+&quot;&quot;);
                  }
                  getActivity().invalidateOptionsMenu();
              }
  
              @Override
              public void onDrawerClosed(View drawerView) {
                  super.onDrawerClosed(drawerView);
                  getActivity().invalidateOptionsMenu();
              }
          };
  
          if(!mUserLearnedDrawer &amp;&amp; !mFromSavedInstanceState){
              mDrawerLayout.openDrawer(containerView);
          }
  
          mDrawerLayout.setDrawerListener(mDrawerToggle);
          mDrawerLayout.post(new Runnable() {
              @Override
              public void run() {
                  mDrawerToggle.syncState();
              }
          });
      }
  
      public void saveToPreferences(Context context, String prefName, String prefValue){
          SharedPreferences sharedPreferences = context.getSharedPreferences(PREF_FILE_NAME, Context.MODE_PRIVATE);
          SharedPreferences.Editor mEditor = sharedPreferences.edit();
          mEditor.putString(prefName, prefValue);
          mEditor.apply();
      }
  
      public static String readFromPreferences(Context context, String prefName, String defaultValue){
          SharedPreferences sharedPreferences = context.getSharedPreferences(PREF_FILE_NAME, Context.MODE_PRIVATE);
          return sharedPreferences.getString(prefName,defaultValue);
      }
  }
  </code></pre>
  <p>Adapter:</p>
  <pre><code>public class DrawerAdapter extends RecyclerView.Adapter&lt;DrawerAdapter.MyViewHolder&gt;{
  
      private LayoutInflater inflator;
      List&lt;DrawerRow&gt; data = Collections.EMPTY_LIST;
  
      public DrawerAdapter(FragmentActivity activity, List&lt;DrawerRow&gt; data) {
          inflator = LayoutInflater.from(activity);
          this.data = data;
      }
  
  
      @Override
      public MyViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
          View view = inflator.inflate(R.layout.nav_drawer_row , viewGroup,false);
          MyViewHolder holder = new MyViewHolder(view);
          return holder;
      }
  
      @Override
      public void onBindViewHolder(MyViewHolder viewHolder, int i) {
          DrawerRow current = data.get(i);
          viewHolder.title.setText(current.title);
          viewHolder.icon.setImageResource(current.iconId);
      }
  
      @Override
      public int getItemCount() {
          return 0;
      }
  
      class MyViewHolder extends RecyclerView.ViewHolder{
          ImageView icon;
          TextView title;
  
          public MyViewHolder(View itemView) {
              super(itemView);
              icon = (ImageView) itemView.findViewById(R.id.list_icon);
              title = (TextView) itemView.findViewById(R.id.list_text);
          }
      }
  }
  </code></pre>
  <p>Drawer Row:</p>
  <pre><code>public class DrawerRow {
      int iconId;
      String title;
  }
  </code></pre>
  <p>Layout:</p>
  <pre><code>&lt;android.support.v4.widget.DrawerLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:id=&quot;@+id/drawerLayout&quot;&gt;
  
      &lt;!--Main Content --&gt;
      &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          android:orientation=&quot;vertical&quot;&gt;
  
          &lt;include
              android:id=&quot;@+id/app_bar&quot;
              layout=&quot;@layout/app_bar&quot; /&gt;
  
          &lt;TextView
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:text=&quot;New Text&quot; /&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;!--Nav Drawer --&gt;
      &lt;fragment
          android:layout_width=&quot;@dimen/nav_drawer_width&quot;
          android:layout_height=&quot;match_parent&quot;
          android:layout_gravity=&quot;start&quot;
          android:name=&quot;uk.co.clickcomputing.hhscweatherstation.NavigationDrawerFragment&quot;
          android:id=&quot;@+id/fragment_navigation_drawer&quot;/&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  <p>Drawer Row:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:orientation=&quot;horizontal&quot; android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;&gt;
  
      &lt;ImageView
          android:padding=&quot;@dimen/list_padding&quot;
          android:id=&quot;@+id/list_icon&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_gravity=&quot;center_vertical&quot;
          android:src=&quot;@drawable/ic_launcher&quot;/&gt;
  
      &lt;TextView
          android:padding=&quot;@dimen/list_padding&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_gravity=&quot;center_vertical&quot;
          android:text=&quot;New Text&quot;
          android:id=&quot;@+id/list_text&quot; /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  <p>Navigation Drawer Fragment Layout:</p>
  <pre><code>&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:background=&quot;#eee&quot;
      android:orientation=&quot;vertical&quot;&gt;
  
          &lt;ImageView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;140dp&quot;
              android:layout_marginBottom=&quot;8dp&quot;
              android:contentDescription=&quot;@string/nav_drawer_img_desciption&quot;
              android:scaleType=&quot;centerCrop&quot;
              android:src=&quot;@drawable/nav_drawer&quot; /&gt;
      
          &lt;android.support.v7.widget.RecyclerView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:id=&quot;@+id/drawerList&quot;&gt;
      
          &lt;/android.support.v7.widget.RecyclerView&gt;
      &lt;/LinearLayout&gt;
  </code></pre>