I found another question here in stackoverflow, but the guy who is asking it solved it by reinstalling ActiveAndroid. This has not worked for me. I have also tried rebuilding my project, also closing and reopening Android Studio.
This is the following error:
ActiveAndroid unresolved symbol Cache
And appears when I try to use these lines:
public static Cursor fetchResultCursor() {
String tableName = Cache.getTableInfo(Players.class).getTableName();
String resultRecords = new Select(tableName + ".*, " + tableName + ".Id as _id").
from(Players.class).toSql();
Cursor resultCursor = Cache.openDatabase().rawQuery(resultRecords, null);
return resultCursor;
}
Also, toSql() says:
toSql() is not public on com.activeandroid.query.From . Cannot be accessed from outside package
Can anyone help me with this, please?
I had to figure out the same thing the other day, this worked for me.
RépondreSupprimerpublic Cursor fetchResultCursor() {
SQLiteDatabase db = ActiveAndroid.getDatabase();
return db.rawQuery("SELECT " +
"Id AS _id, " +
"someColumnName, " +
"anotherColumnName " +
"FROM YourTableName", null);
}