0
我有一個hashmap方法是;調用hashmap地圖
public HashMap<String, String> getUserDetails(){
HashMap<String,String> user = new HashMap<String,String>();
String selectQuery = "SELECT * FROM " + TABLE_LOGIN;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// Move to first row
cursor.moveToFirst();
if(cursor.getCount() > 0){
user.put("name", cursor.getString(1));
user.put("email", cursor.getString(2));
user.put("uid", cursor.getString(3));
user.put("created_at", cursor.getString(4));
}
cursor.close();
db.close();
// return user
return user;
}
我有一個字符串電子郵件,我想要獲得id = 10的方法的電子郵件。 如何設置電子郵件基本等於該特定字符串; String email = getUserDetails(email where ID = 10)我知道我走了,但你明白了。
你怎麼認爲額外的標籤和一個有些模糊的問題會有幫助嗎? – Mark
'SELECT name,email,uid,created_at FROM my_table WHERE id = 10'? –
http://docs.oracle.com/javase/tutorial/java/javaOO/arguments.html – The111