0

I have an EditText and WebView.
I wanna show custom search view when user press Control + F.
Below codes works when EditText is in focused state.
But after I touch WebView (EditText is not focused), it do not work. How can I do? Please help me, thanks.

@Override
public boolean onKeyUp(int keyCode, KeyEvent event)
{
    switch(keyCode){
        case (KeyEvent.KEYCODE_F):
            if(event.isCtrlPressed()){
                //show Custom View
            }
        return true;
        default:
            return super.onKeyUp(keyCode, event);
    }
}
ankuranurag2
  • 2,300
  • 15
  • 30
  • did you check it >https://stackoverflow.com/questions/11429878/read-keyboard-events-in-android-webview – Adil Jan 23 '19 at 06:08
  • check it might helps you -https://stackoverflow.com/questions/26346070/listen-webview-key-events-from-software-keyboard-in-android-activity – Adil Jan 23 '19 at 09:20

1 Answers1

0

Problem solved.
I disable gaining EditText focus at Activity startup by using this xml code in parent view.

android:focusableInTouchMode="true"

It works at all.