Bind a onKeyDown to a particular webview android
<p>Hey I am working on implementing the back key functionality for my WebViews. I have got it working with the given code but the problem is I need it to work for 3 different WebViews so none conflict with each other and cause a crash, so far it works for each one singly at a time. My guess is I need to bind the keylistener to that particular webview but I am unsure how. Here is the code I am using for my youtube view for example..</p>

<pre><code>@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {

    wv_yt = (WebView) findViewById(R.id.web_youtube);

    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (keyCode) {
        case KeyEvent.KEYCODE_BACK:
            if (wv_yt.canGoBack() == true) {
                wv_yt.goBack();

            } else {
                finish();
            }
            return true;

        }

    }
    return super.onKeyDown(keyCode, event);
}
</code></pre>
