To create a basic Adapter which can be used by the RecyclerView create a new class and extend RecyclerView.Adapter
Once you do this you need to override the following three methods
- The getItemCount method is used to return the number of items in the data set.
- The onCreateViewHolder method is used to create the views.
- The onBindViewHolder method is used to bind views to data.
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return null; } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } @Override public int getItemCount() { return 0; }
Source Code is available here