0
這是插入代碼SQLlite要求任何回報
for(int i = 0 ;pseudo.size() <= i; i++){
ContentValues values = new ContentValues();
String contact = (String) pseudo.get(i);
values.put("pseudo", contact);
values.put("adresse", "test");
values.put("image", "test");
values.put("ID", "5");
dbwrite.insert("Contact", null, values);
}
,這是讀碼
String[] retour = {
"pseudo",
"xmppadresse",
"image", "ID"
};
Cursor cursor = dbread.query("Contact", retour, null, null, null, null, "pseudo");
Log.d("debug", "populateWithInitialContacts: "+cursor.getCount());
while(cursor.moveToNext()) {
String pseudo = cursor.getString(cursor.getColumnIndexOrThrow("pseudo"));
Log.d("debug", "getcontact: "+pseudo);
listcontact.add(new Contact(pseudo));
}
cursor.close();
我的要求任何回報(這是使用databasse SQLite的Android中我第一次)
什麼'Log.d(「debug」,「populateWithInitialContacts:」+ cursor.getCount());'print out? – petey
@petey這個日誌打印「populateWithInitialContacts:0」 – therapha361