Q:

Android - TabHost Tab Change causing webview to lose focus and edittext to gain focus

I have a tabhost that has 4 tabs with webviews and edittexts in each. The problem is, when the tab is changed, the webviews lose focus and the edittexts gain focus. I've Googled to narnia and back but everyone else seems to have the problem of edittexts losing focus... that's why I'm asking on here. How do I make it so that whenever the tabs are changed, the edittexts do not gain focus but the webviews do.
Thanks for all help, in advance!

A:

You'll need to find what webview to request focus for, since you're using tabhost, checking for visibility wont work. So you'll have to check if the view is shown using-
if (webview.isShown()) {
        webview.requestFocus();
            }
        else{
        }

and do this for all your webview you want to have the focus for.
You could attach this to a button or anything, hope this is what you were looking for.

