我使用下面的代碼從sqlite獲取特定的記錄。無法顯示從sqlite獲取的記錄
public String getDetails(long phone) throws SQLException{
Cursor mCursor = db.query(true, DATABASE_TABLE, new String[] {NAME, AGE, AREA, PHONE, SEX}, PHONE + "=" + phone, null, null, null, null, null);
if(mCursor != null){
mCursor.moveToFirst();
}
String result = mCursor.getString(mCursor.getColumnIndex(NAME));
return result;
}
我打電話來,從另一類這個方法與下面的代碼
dbAdapterExisting.read();
String temp = dbAdapterExisting.getDetails(mobile);
dbAdapterExisting.close();
textViewExistingName.setText(temp);
記錄越來越牽強和我能夠在TextView中顯示的「名稱」字段中,但我怎麼取所有的領域,即'年齡','地區','性別',並顯示在不同的文字瀏覽。
非常感謝,這段代碼工作得很好。 – User210282