Question

The method setSuggestionsAdapter of a SearchView gives me a strange Error:

I have a class InformationAdapter that extends CursorAdapter, but it says me that I cannot cast it to an CursorAdapter.

The method setSuggestionsAdapter(CursorAdapter) in the type SearchView is not applicable for the arguments (InformationAdapter)

      InformationAdapter suggestionsAdapter = new InformationAdapter(false, this, suggestions, CursorAdapter.NO_SELECTION);
      searchView.setSuggestionsAdapter(suggestionsAdapter);
Was it helpful?

Solution

So I have now figured out what the mistake was:

My InformationAdapter used to extend the CursorAdapter from the support.v4 Framework. That did not work. Changing to import android.widget.CursorAdapter; solved the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top