In our project we need to store databases to an external SD-card instead of the default path. To do this we have a custom class that inherits from ContextWrapper
and overrides openOrCreateDatabase
:
@Override
public SQLiteDatabase openOrCreateDatabase(String name,
int mode,
SQLiteDatabase.CursorFactory factory) {
...
}
In API level 11 a new version of openOrCreateDatabase
was added that adds a parameter of type DatabaseErrorHandler
. On ICS it seems like it's this version that is called. I have verified this using:
@Override
public SQLiteDatabase openOrCreateDatabase(String name,
int mode,
SQLiteDatabase.CursorFactory factory,
DatabaseErrorHandler errorHandler) {
return openOrCreateDatabase(name, mode, factory);
}
The problem is that I cannot add this function to the code because DatabaseErrorHandler
was added in API level 11 and I need to have backwards compatibility with at least API level 8.
So how to I solve this issue?