Вопрос

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);
Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top