I want to show some default suggestions in SearchView when User hasn\'t typed anything. I am setting my custom suggestion adapter manually using matrix cursor. I tried setting
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
vwSearch = (SearchView) menu.findItem(R.id.menu_main_search).getActionView();
vwSearch.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
//Do something on Submit
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
//Do something on change
return true;
}
});
vwSearch.setOnCloseListener(new SearchView.OnCloseListener() {
@Override
public boolean onClose() {
//Do something on collapse Searchview
return false;
}
});
return true;
}