How does newView() for CursorAdapter work?
<p>I'm slightly confused on how the <code>newView()</code> of <code>CursorAdapter</code> works. I'm interested what <code>Cursor c</code> is passed to the method by the Framework in particular. I have a <code>ListView</code> which filled with a <code>CursorAdapter</code> which contains 4 rows. After some debagging I see two different <code>Cursor c</code> objects passed to the <code>newView()</code> and this fact confuses me. </p>

<p>I was expecting the different <code>Cursor</code> is passed to the method, different <code>Cursor</code> object per <code>row</code> in the database. So with this assumption in mind I was setting onClick listeners on checkbox element of a listview row, but this just work very strange.</p>

<pre><code>  @Override
        public View newView(Context ctxt, Cursor c, ViewGroup parent) {
            View row;
            final Cursor cursor = c;
            LayoutInflater inflater = ((Activity) ctxt).getLayoutInflater();
            row = inflater.inflate(R.layout.row, parent, false);
            this.defaultDrawable = (Drawable) row.getBackground();
            final CheckBox mStar = (CheckBox) row.findViewById(R.id.star);
            mStar.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View view) {
                    if (mStar.isChecked()) {
                        mDbHelper.updateFavorite(cursor, 1);
                    } else {
                        mDbHelper.updateFavorite(cursor, 0);
                    }
                }
            });

            ViewHolder holder = new ViewHolder(row);

            row.setTag(holder);

            return (row);
        }
</code></pre>
