Please look into this and let me know what went wrong.
public class MyAdapter extends RecyclerView.Adapter {
private ItemData[]
Your itemsData
parameter passed to the MyAdapter
's constructor is null or you are using the second constructor which is not initializes the itemsData
class member. You can check it for null and return 0 from the getItemCount
method:
@Override
public int getItemCount() {
return itemsData == null ? 0 : itemsData.length;
}