public String getContact(String searchName) {
SQLiteDatabase db = this.getReadableDatabase();
String[] args = { searchName };
Cursor cursor = db.rawQuery("SELECT * FROM " + TABLE_MOVIES
+ " WHERE name =? ", args);
String iName = null, iDiretor = null, iGenre = null;
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
iName = cursor.getString(cursor.getColumnIndex(KEY_NAME));
iDiretor = cursor.getString(cursor.getColumnIndex(KEY_DIRECTOR));
iGenre = cursor.getString(cursor.getColumnIndex(KEY_GENRE));
cursor.moveToNext();
}
cursor.close();
iName 变量工作正常,但其他两个返回 null。有什么帮助吗?