Is it possible to make CursorAdapter be set in recycleview, just like ListView?

I didn’t google out a solution till now to replace listview in my project, because I need to use the cursor linked with the sqlite.

Old way as followed:
listview.setAdapter(cursorAdapter) in this way, I can get the cursor to deal with data in database

  • Broadcast Receiver calles twice
  • Android “Only the original thread that created a view hierarchy can touch its views.”
  • Android - How to use the PhoneGap Share plugin
  • Put Navigation Drawer Under Status Bar
  • How to use Actions from Notification without starting Activity
  • ClassNotFoundException after ADT update
  • but now, recycleview.setAdapter(recycleview.adapter) it doesn’t recognize the adapter extending BaseAdapter

    so anyone can give me a hand?

    Related posts:

    Intellij Content is not allowed in prolog
    Android - How to check Proguard obfuscation has worked?
    Creating a ListView with custom list items programmatically in Android - no xml list item layout
    How to use setImageUri() on Android
    Why do the TabLayout's tabs' icons/texts blink when swiping between pages?
    How to set dialog window background to transparent, without affecting its margin
  • How to open AlertDialog from preference screen?
  • “Prefer to run the dagger processor over that class instead” in Kotlin
  • How to auto-adjust text size on a multi-line TextView according to the view max dimensions?
  • Upgraded to AppCompat v22.1.0 and now getting IllegalArgumentException: AppCompat does not support the current theme features
  • Action bar does not show
  • android disable seek bar for audio controller
  • 2 Solutions collect form web for “Is it possible to make CursorAdapter be set in recycleview, just like ListView?”

    The new RecyclerView works with a new RecyclerView.Adapter base class.
    So it doesn’t work with the CursorAdapter.

    Currently there is no default implementation of RecyclerView.Adapter available.

    May be with the official release, Google will add it.

    Implementing it yourself is actually quite simple:

    public class CursorAdapter extends RecyclerView.Adapter<ViewHolder>{
        Cursor dataCursor;
        public int getItemCount() {
            return (dataCursor == null) ? 0 : dataCursor.getCount();
        public void changeCursor(Cursor cursor) {
            Cursor old = swapCursor(cursor);
            if (old != null) {
         public Cursor swapCursor(Cursor cursor) {
            if (dataCursor == cursor) {
              return null;
            Cursor oldCursor = dataCursor;
            this.dataCursor = cursor;
            if (cursor != null) {
            return oldCursor;
        private Object getItem(int position) {
            // Load data from dataCursor and return it...
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.