public Cursor fetchThePassword(long paramLong) throws SQLException {
SQLiteDatabase localSQLiteDatabase = this.db;
String[] localObject = new String[2];
localObject[0] = "id";
localObject[1] = "pass";
localObject = localSQLiteDatabase.query(true, "register", localObject, "id=" +aramLong, null, null, null, null, null);
if (localObject != null)
((Cursor)localObject).moveToFirst();
return localObject;
}
答案 0 :(得分:0)
您创建一个字符串数组localObject
并将其强制转换为Cursor
。这不行。
((Cursor)localObject).moveToFirst();
答案 1 :(得分:0)
我不知道你到底想要做什么,但最好的猜测如下:
public String fetchThePassword(long paramLong) throws SQLException {
SQLiteDatabase localSQLiteDatabase = this.db;
String[] columns = new String[] { "pass" };
Cursor cursor = localSQLiteDatabase.query(true, "register", columns, "id=" + paramLong,
null, null, null, null, null);
String result = null;
if (cursor.moveToFirst()) {
// value from the pass column
result = cursor.getString(0);
}
cursor.close();
// result is either the pass or null
return result;
}