开发者

How to Increment the cursor values?

开发者 https://www.devze.com 2023-04-09 12:12 出处:网络
My database have 12 values i use the table layout with list view but in the second row its again started to show second value from the database

My database have 12 values i use the table layout with list view but in the second row its again started to show second value from the database

 class NoteHolder {
    private Button b1 = null;
    private Button b2 = null;
    private Button b3 = null;


    NoteHolder(View row) {
        b1 = (Button) row.findViewById(R.id.one);
        b2 = (Button) row.findViewById(R.id.t开发者_JAVA技巧wo);
        b3 = (Button) row.findViewById(R.id.three);

    }

    void populateFrom(Cursor c, NoteHelper helper) {
        b1.setText(helper.getNote(c));
            c.moveToNext();
        b2.setText(helper.getNote(c));
        c.moveToNext();
        b3.setText(helper.getNote(c));

    }

}


Cursor.moveToNext() moves the cursor.

http://developer.android.com/reference/android/database/Cursor.html#moveToNext%28%29


Remove static keyword from you class.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号