如果启用text =cursor.getString(cursor.getColumnIndexOrThrow(KEY_BODY));
public String getPhone(long rowId){
SQLiteDatabase cb = mDbHelper.getReadableDatabase();
String text = null ;
Cursor cursor=cb.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_TITLE,
KEY_BODY,KEY_EMAIL},KEY_ROWID + " = ?"+rowId, null, null, null,null);
//text = cursor.getString(cursor.getColumnIndexOrThrow(KEY_BODY));
return text;
}
答案 0 :(得分:1)
好吧,你没有正确传递参数:
你是怎么做的:
public String getPhone(String rowId){
SQLiteDatabase cb = mDbHelper.getReadableDatabase();
String text = null ;
Cursor cursor=cb.query(DATABASE_TABLE, new String[]
{KEY_ROWID, KEY_TITLE, KEY_BODY,KEY_EMAIL},KEY_ROWID + " = ?",new String[]{rowId}, null, null,null);
if(cursor.moveToFirst())
text =cursor.getString(cursor.getColumnIndexOrThrow(KEY_BODY));
else
return "";