Android Content Provider 详解
2010-05-31 14:33:00 来源:WEB开发网核心提示:if (cur.moveToFirst()) {String id = null;String userName = null;do {id = cur.getString(cur.getColumnIndex(MyUsers.User._ID));userName = cur.getString(cur.getCol
if (cur.moveToFirst()) {
String id = null;
String userName = null;
do {
id = cur.getString(cur.getColumnIndex(MyUsers.User._ID));
userName = cur.getString(cur.getColumnIndex(MyUsers.User.USER_NAME));
Toast.makeText(this, id + ” ” + userName, Toast.LENGTH_LONG).show();
} while (cur.moveToNext());
}
}
}
上面的类将先向数据库中添加一条用户数据,然后显示数据库中所有的用户数据。
[]
赞助商链接