Search code examples
androidsearchviewandroid-cursoradapter

Retrieve CursorAdapter with activeAndroid and SearchView


I try to implement a "android.support.v7.widget.SearchView" into my toolBar who should provide some suggestions to the user.

I wished activeAndroid could provide me a way to retrieve a CursorAdapter directly from my query (basically a getAll()).

The following link seems to be deprecated since .toSql() require private access and "Cache" is unresolved.

Any idea?


Solution

  • You can create a Cursor via ActiveAndroid using:

    Cursor cursor = ActiveAndroid.getDatabase().rawQuery("SELECT * FROM TABLE", null);

    The CursorAdapter you will need to build yourself but is quite easy and the "Defining the Adapter" section of the link you provided should give you what you need to get started.