• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

onBindViewHolder Trouble

I'm going through a tutorial and adapting it to my own project. I ran into an issue and because this is new to me, I'm stumped as to how to fix this. I'm working with a recyclerView saving and loading from an sqlite database.

In the Adapter class:
Java:
@Override
    public void onBindViewHolder(@NonNull EmotionalViewHolder holder, int position)
    {
        if(!mCursor.moveToPosition(position))
        {
            return;
        }

       String var=mCursor.getString(mCursor.getColumnIndex(Contract.Columns));        holder.varText.setText(var);
    }

Unlike the tutorial, I am using a separate class to isolate all db functions. I did not set up a Contract class, but I'm not sure I really need one as I've seen other examples that do not use one. So my question is what do I need to put in those last two lines so I can get the string from the database?
Thanks! If anyone knows a good tutorial that demonstrates this in the same way I am doing it, please let me know.
 
Back
Top Bottom