Here is my code
@Override
public void onBindViewHolder(@NonNull MyRecyclerViewForFav.MyViewHolder holder, int position) {
data d = new data();
// if( cursor.moveToNext() )
// Log.d("this2",);
cursor.moveToNext();
Log.d("this2",cursor.getInt(1)+"");
String temp = d.Convert(str, position);
holder.textView.setText(temp);
holder.rowNumber.setText((position + 1) + ".");
}
if i print the size of cursor using getCount() it works fine but when trying to access the elements app crashes
Having
cursor.moveToNext()inonBindViewHolder()does not make sense. It would only work if the user scrolled down, it won't work when the user scrolls up. Rather usemoveToPosition(position).