我有一个数据库由4个文件组成,其中一个是Text,现在我想通过使用查询获取Text并在TextView中显示,我应该怎么做? 请帮帮我!
我的源代码:
value = getIntent().getStringExtra("position");
Load_Database();
db = myDbHelper.getReadableDatabase();
Cursor c = db.rawQuery("select text from movie_list where name = '"+value+"'" , null);
????????
private void Load_Database() throws Error {
myDbHelper = new MovieDB(DisplayActivity.this);
try {
myDbHelper.createDataBase();
} catch (IOException ioe) {
throw new Error("Unable to create database");
}
try {
myDbHelper.openDataBase();
} catch (SQLException sqle) {
throw sqle;
}
}
答案 0 :(得分:0)
if (cursor.moveToFirst()){
do{
String data = cursor.getString(cursor.getColumnIndex("text"));
//do stuff...
}while(cursor.moveToNext());
}
cursor.close();