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.
精彩评论