I\'ve followed this Android guide in order to add a search bar to an activity. The setup looks like this:
res/menu/activity_main.xml:
In my case the problem was my mistake during integration with ActionBarSherlock. In this case android:actionViewClass
should be com.actionbarsherlock.widget.SearchView
instead of android.widget.SearchView
. I know this sounds dumb, but I spent 20 minutes trying to figure out why searchView
is null
in my code that is similar to yours.