我在 DatabaseHandler.java 中有函数
/**
* Getting user data from database
* */
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("id_user", cursor.getString(1));
user.put("name", cursor.getString(2));
user.put("email", cursor.getString(3));
user.put("regid", cursor.getString(4));
user.put("jenis_kelamin", cursor.getString(5));
user.put("tanggal_lahir", cursor.getString(6));
user.put("instansi", cursor.getString(7));
user.put("jabatan", cursor.getString(8));
user.put("dibuat_at", cursor.getString(9));
}
cursor.close();
db.close();
// return user
return user;
}
以及我如何从数据库中获取数据 id_user、姓名、电子邮件等以显示在 MainActivity.java 中的问题,请帮助