com.arconsis.android.datarobot.DbClosingCursor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of datarobot.api Show documentation
Show all versions of datarobot.api Show documentation
Datarobot for Android is a lightweight framework, which frees you from the burden of dealing with Androids SQLite database directly if you don't want to and let's you access it directly if you have to.
The newest version!
package com.arconsis.android.datarobot;
import android.database.Cursor;
import android.database.CursorWrapper;
/**
* A cursor also handling the reduction of open database connections when closed. It should be used e.g. in combination with CursorAdapter.
*
* @author Falk Appel
* @author Alexander Frank
*/
class DbClosingCursor extends CursorWrapper {
private final DbCreator dbCreator;
public DbClosingCursor(Cursor cursor, DbCreator dbCreator) {
super(cursor);
this.dbCreator = dbCreator;
}
@Override
public void close() {
super.close();
dbCreator.reduceDatabaseConnection();
}
}