title: Android Adapter failing to fill activity with views
body: <p>In my MainActivity I use a RecyclerView to fill an activity with images and names, but when I run the app the activity is empty. An adapter is called that is filled with and array of data objects that contain an &quot;id&quot;. The adapter inflates the item_view and uses a ViewHolder that holds a textview and acts as an onClickListener.</p>
  <p>Any ideas as to why it remains empty and how I may fill it?</p>
  <p>MainActivity:</p>
  <pre><code>package com.com.com;
  
  import androidx.appcompat.app.AppCompatActivity;
  import androidx.recyclerview.widget.LinearLayoutManager;
  import androidx.recyclerview.widget.RecyclerView;
  
  import android.os.Bundle;
  
  import java.util.ArrayList;
  import java.util.List;
  
  public class MainActivity extends AppCompatActivity {
  
      private RecyclerView mRecyclerView;
      private RecyclerView.Adapter mDataAdapter;
      private RecyclerView.LayoutManager mDataLayoutManager;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          mRecyclerView = (RecyclerView)  findViewById(R.id.recyclerView);
          mRecyclerView.setNestedScrollingEnabled(false);
          mRecyclerView.setHasFixedSize(true);
          mMatchesLayoutManager = new LinearLayoutManager(MainActivity.this);
          mRecyclerView.setLayoutManager(mDataLayoutManager);
          mDataAdapter = new DataAdapter(getDataSetData(), MainActivity.this);
          mRecyclerView.setAdapter(mDataAdapter);
  
          for (int i = 0; i &lt; 10; i++) {
              DataObject obj = new DataObject(Integer.toString(i));
              resultsData.add(obj);
          }
          mDataAdapter.notifyDataSetChanged();
      }
  
      private ArrayList&lt;DataObject&gt; resultsData = new ArrayList&lt;DataObject&gt;();
      private List&lt;DataObject&gt; getDataSetData() {
          return resultsData;
      }
  }
  </code></pre>
  <p>DataAdapter:</p>
  <pre><code>package com.com.com;
  
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  import androidx.recyclerview.widget.RecyclerView;
  
  import java.util.List;
  
  public class DataAdapter extends RecyclerView.Adapter&lt;DataViewHolders&gt;{
  
      private List&lt;DataObject&gt; dataList;
      private Context context;
  
      public DataAdapter(List&lt;DataObject&gt; dataList, Context context) {
          this.dataList = dataList;
          this.context = context;
      }
  
      @Override
      public DataViewHolders onCreateViewHolder(ViewGroup parent, int viewType) {
  
          View layoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_data, null, false);
          RecyclerView.LayoutParams lp = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          layoutView.setLayoutParams(lp);
          DataViewHolders rcv = new DataViewHolders((layoutView));
  
          return rcv;
      }
  
      @Override
      public void onBindViewHolder(DataViewHolders holder, int position) {
          holder.mDataId.setText(dataList.get(position).getId());
  
      }
  
      @Override
      public int getItemCount() {
          return 0;
      }
  }
  
  </code></pre>
  <p>DataObject:</p>
  <pre><code>package com.com.com;
  
  public class DataObject {
      private String Id;
  
      public DataObject (String Id) {
          this.Id= Id;
      }
  
      public String getId() {
          return Id;
      }
  
      public void setId(String Id) {
          this.Id= Id;
      }
  
  }
  </code></pre>
  <p>DataViewHolders:</p>
  <pre><code>package com.com.com;
  
  import android.view.View;
  import android.widget.TextView;
  
  import androidx.recyclerview.widget.RecyclerView;
  
  public class DatasViewHolders extends RecyclerView.ViewHolder implements View.OnClickListener {
  
      public TextView mDataId;
  
      public DataViewHolders(View itemView) {
          super(itemView);
          itemView.setOnClickListener(this);
  
          mDataId = (TextView) itemView.findViewById(R.id.Dataid);
      }
  
      @Override
      public void onClick(View v) {
  
      }
  }
  </code></pre>
  <p>activity_main:</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;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.MainActivity&quot;
      android:orientation=&quot;vertical&quot;&gt;
  
      &lt;androidx.core.widget.NestedScrollView
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;&gt;
  
          &lt;androidx.recyclerview.widget.RecyclerView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:id=&quot;@+id/recyclerView&quot;
              android:scrollbars=&quot;vertical&quot;&gt;
  
          &lt;/androidx.recyclerview.widget.RecyclerView&gt;
      &lt;/androidx.core.widget.NestedScrollView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  <p>item_data:</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:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:orientation=&quot;horizontal&quot;
      android:padding=&quot;20sp&quot;&gt;
  
      &lt;ImageView
          android:layout_width=&quot;75sp&quot;
          android:layout_height=&quot;75sp&quot;
          android:src=&quot;@mipmap/ic_launcher&quot; /&gt;
  
      &lt;TextView
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:text=&quot;Data ID&quot;
          android:layout_gravity=&quot;center&quot;
          android:id=&quot;@+id/Dataid&quot; /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>