I'm using a SearchView widget to perform a search which includes the query and some other information from CheckBoxes.
I followed the guide for using the SearchView widget and it works great - but because I have additional info to add to the search, I want to have a FloatingActionButton trigger the search.
My code so far for setting up the search
private void setUpSearchCard(View layout) {
// Retrieve SearchManager and the SearchView
final SearchManager searchManager = (SearchManager) getContext()
.getSystemService((Context.SEARCH_SERVICE));
mSearchView = (SearchView) layout.findViewById(R.id.search_view);
// Direct the SearchView to the activity that will get the result
mSearchView.setSearchableInfo(searchManager.getSearchableInfo(
new ComponentName(getContext(), SwipeDeckActivity.class)
));
// Expand the bar by default
mSearchView.setIconifiedByDefault(false);
}
What I wish to add to this function is something like this
// Set up the search fab
mSearchFAB = (FloatingActionButton) layout.findViewById(R.id.fab_search_button);
mSearchFAB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mSearchView.launchSearch();
}
});
How can I do that? (Obviously the query that was inserted should be sent)
P.S. I do not want to use the Android supplied button that pops on the SearchView