Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The cursor in the adapter is not set to the correct row.</p> <p>First of all you should get rid of your own member variables for the cursor and the context! Then try to implement the bindView method of the CursorAdapter, it will provide the cursor already set to the current row:</p> <pre><code>public class MyDataAdapter extends SimpleCursorAdapter { private ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); private ArrayList&lt;Boolean&gt; itemCheckedHere = new ArrayList&lt;Boolean&gt;(); private ArrayList&lt;Boolean&gt; itemCheckedLate = new ArrayList&lt;Boolean&gt;(); private ArrayList&lt;Integer&gt; itemCheckedIdx = new ArrayList&lt;Integer&gt;(); // itemChecked will store the position of the checked items. public MyDataAdapter(Context context, int layout, Cursor c, String[] from, int[] to) { super(context, layout, c, from, to); for (int i = 0; i &lt; c.getCount(); i++) { itemCheckedHere.add(i, false); // initializes all items value with false itemCheckedLate.add(i, false); // initializes all items value with false } } public void bindView (View inView, Context context, Cursor cursor){ super.bindView(inView,context,cursor); TextView studentName; ImageView studentPhoto; //inView is never null in bindView final CheckBox cBoxH = (CheckBox) inView.findViewById(R.id.attend); final CheckBox cBoxL = (CheckBox) inView.findViewById(R.id.late); // set up name field studentName = (TextView) inView.findViewById(R.id.stuname); if (studentName != null) { int index = cursor.getColumnIndex(gradeBookDbAdapter.KEY_NAME); String name = cursor.getString(index); studentName.setText(name); } //your other code } //other methods </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload