I have implemented search view for my application. When i try to query i show results using Listview and want use to select one of them. If not available list will be empty. However people can click search icon/go in soft keyboard i want to hide that button.
I want user to select values from suggestions only and not search separately
How can we achieve this?
Just prevent the user from using the button whenever the value is not in your list. To do that you can just handle the clicking of the enter button.
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_ENTER:
if(isTextInList())
return true;
return false;
default:
return super.onKeyUp(keyCode, event);
}
}
for more info: http://developer.android.com/training/keyboard-input/commands.html#SingleKey
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