Ich entwickle eine einfache Listview, aber ich erhalte eine falsche Information und nicht eine korrekte Datenform db.Korrigieren Sie die Ansicht Ausstellung auf Android
List<Category> values = cdao.listAllItems();
ArrayAdapter<Category> adapter = new ArrayAdapter<Category>(this,
R.layout.row, values);
setListAdapter(adapter);
public List<Category> listAllItems() {
List<Category> list = new ArrayList<Category>();
Cursor cursor = db.rawQuery("SELECT _id, category " +
" FROM category", null);
while (cursor.moveToNext()) {
Category c = new Category();
c.setId(cursor.getInt(cursor.getColumnIndex("_id")));
c.setCategory(cursor.getString(cursor.getColumnIndex("category")));
list.add(c);
Log.d(wallet.utils.Constants.TAG, c.getCategory());
}
return list;
}
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:textSize="16sp" >
</TextView>
Das Ergebnis hiervon ist: [email protected] und der richtige Wert muss das Wort „Allgemein“ sein.
Was ist los?
danke im voraus.