質問

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