RecyclerViewCursorAdapter Library

Today I released my first library which is for a RecyclerviewCursorAdapter.

Using a ListView to display database data becomes a lot easier when you use a CursorAdapter combined with a CursorLoader to display data from your ContentProvider. The main benefit of CursorLoader is explained in the docs:

This class implements the Loader protocol in a standard way for querying cursors, building on AsyncTaskLoader to perform the cursor query on a background thread so that it does not block the application’s UI.

The CursorAdapter helped by efficiently clearing the reference to the Cursor that it held, so the responsibility didn’t fall on the developer.

When ListView was replaced by RecyclerView, it came with a different type of Adapter with no CursorAdapter implementation. After being inspired by a StackOverflow answer to see how a CursorAdapter could be used as the underlying data source of a RecyclerView.Adapter class, I quickly abstracted the idea into a library. You can find this library with samples on GitHub. The README there will explain how to include this library in your project and get started using the CursorAdapter with your RecyclerView!

Adam McNeilly

Adam McNeilly
Software Engineer and Android development enthusiast.

Fingerprint Authentication Tutorial

Step by step guide to creating a fingerprint authentication flow for Android. Continue reading

Guest Authors Wanted

Published on October 21, 2017

Developing And Publishing Android Libraries

Published on October 19, 2017