0

I'm working on implementing the use of SQLite into my android application. I am using ActiveAndroid. I believe it's installed correctly: I can import com.activeandroid.Model successfully, as well as the annotations import com.activeandroid.annotation.Column. I have android:name="com.activeandroid.app.Application" in the AndroidManifest.xml. I am using Android Studio as my IDE.

But when I try to add the following method to my model, I get an error on Cache:

public static Cursor fetchResultCursor() {
    String tableName = Cache.getTableName();
    String resultRecords = new Select(tableName + ".*, " + tableName + ".Id as _id").
        from(Item.class).toSql();
    Cursor resultCursor = Cache.openDatabase().rawQuery(resultRecords, null);
    return resultCursor;
}

I tried manually adding import com.activeandroid.Cache; to the imports, but even then it doesn't recognize it. What am I doing wrong?

Edit Once I reinstalled ActiveAndroid, the problem went away. I don't understand how before it only installed some ActiveAndroid classes but not others.

Marina
  • 3,222
  • 5
  • 25
  • 35
  • if `import com.activeandroid.Cache;` doesn't work, try to restart your IDE, refresh all libraries and check that you have added the correct library version. That thing exists and must resolve. – zapl Dec 11 '14 at 23:32
  • @zapl Restarting doesn't work. I don't know if this helps, but it also won't recognize SQLiteUtils. – Marina Dec 12 '14 at 02:04

0 Answers0