I want to pop up the software keyboard when the user presses the search hardware search key.
At the moment I use the following function with doesn't seem to work for the search key but which does work for the back key: The logging doesn't get even tiggered through the search key.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_BACK){ Log.v(TAG, "On back key press"); renderPrevious();
return false;
}
if(keyCode == KeyEvent.KEYCODE_SEARCH){
Log.v(TAG, "On search key press");
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
return false;
}
return true;
}
I have no text field but want to handle the input directly myself if that matters.