Why do we use something like this to populate the recyclerview with data? Can't we just create a simple array of string like String[] titles and display them, like in ListView?
List< Information> data
public void onBindViewHolder(MyViewHolder holder, int position) {
Information current = data.get(position);
holder.title.setText(current.title);
holder.icon.setImageResource(current.iconId);
}
I recently watched a video on how to work with recyclerview and I can't understand why we have to create another class of information and then again create its array inside onBindViewHolder to show data.
Can anybody help me understand this code?