ormlite-android-extras
ormlite-android-extras copied to clipboard
Improving performance for Cursor
Hello,
I noticed that performance is improved in cursor by using caching AndroidResult in CursorAdapter
public abstract class OrmliteCursorAdapter<T> extends CursorAdapter
{
// Stripped code...
private AndroidDatabaseResults results;
@Override
public void bindView(View itemView, Context context, Cursor cursor)
{
try
{
if (results == null)
results = new AndroidDatabaseResults(cursor, null);
T item = mQuery.mapRow(results);
bindView(itemView, context, item);
}
catch(SQLException e)
{
e.printStackTrace();
}
}
I have some tests on my hand and it seems that it does not introduce regression.
Cheers.