I am having issues getting my submit button for the query to work. I have this part of my code here
searchView.setIconifiedByDefault(true); //iconify the widget
searchView.setSubmitButtonEnabled(true);
and I also have a listener
new SearchView.OnQueryTextListener(){
@Override
public boolean onQueryTextChange(String newText) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean onQueryTextSubmit(String query) {
// TODO Auto-generated method stub
//Output the new list with the query results
Context context = getApplicationContext();
CharSequence start = "Start";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, start, duration);
toast.show();
return false;
}
};
When the submit button is clicked, it does not show the toast so I am assuming that when the submit button is clicked, it is not doing what it is supposed to do. I don't know what is wrong here.
You have to call
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener());
on your SearchView.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With