Sergio Asked: 2020-01-06 14:54:45 +0800 CST 2020-01-06 14:54:45 +0800 CST 2020-01-06 14:54:45 +0800 CST SearchView Implementation 772 I am trying to use a filter, but when I run the app it closes java 1 Answers Voted Best Answer Keops 2020-01-06T15:32:18+08:002020-01-06T15:32:18+08:00 You have a cast error, in your menu.xml you should have something like this: <item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" android:showAsAction="collapseActionView|ifRoom" android:actionViewClass="android.support.v7.widget.SearchView" /> And in your Activity you are importing something like this: import android.widget.SearchView; In the XML and in the activity you must call the same element
You have a cast error, in your menu.xml you should have something like this:
And in your Activity you are importing something like this:
In the XML and in the activity you must call the same element