5

Android's WebView is correctly displaying the option items, but when I try to select one of them, the dropdown popup closes, the default selection keeps showing up and the dropdown menu freezes which means another click doesn't display the selection popup again.

This misbehavoir occures, as far I could test it, only on emulators and the HTC One. I've test it on devices like: HTC Disire , HTC Disire HD, Samsung Galaxy GT-I5500 and Samsung S3 where everythings works just fine.

It seems like the HTC One doesn't support select / option element used in a WebView.

It doesn't make difference if I load the content via local loadData or loadUrl from a website.

content:

<body>
    <select >
        <option value='option1'>option1</option>
        <option value='option2'>option2</option>
    </select>
</body>

Anyone with the same experiences and solutions?

Daniel Widdis
  • 8,424
  • 13
  • 41
  • 63
casaflowa
  • 51
  • 1
  • 4
  • 1
    Experiencing the exact same problem on a Nexus 7 with Android 4.3. Simple menu like yours. I can click it once, it displays the options. I tap an item and the menu closes, and I can't open it again. Tested on Galaxy S3 with Android 4.1, works fine. The – Paul McClean Oct 09 '13 at 15:35
  • Yep, seeing this as well - on both a HTC One running 4.2 and a Nexus 7 running 4.3. – Mark Beaton Oct 14 '13 at 01:41
  • I am getting this issue on the HTC One Also. Anyone found a solution? Seems absolutely ridiculous that this is happening – TommyGuns21 Dec 23 '13 at 10:54
  • In my case removing the WebView **getSettings().setJavaScriptEnabled(true);** property, fixes the issue. But I could not remove this as I am doing lot of stuff in WebChromeClient. – r.bhardwaj Apr 06 '15 at 11:47

1 Answers1

2

I had a similar issue. the WebView did not open the context menu on clicking the:

 <option value='op1'>first</option>
 <option value='op2'>second</option>

in the html page.

The problem was that the context of the WebView wasn't the same as the current Activity where the WebView was displayed.

My solution was to use MutableContextWraper and chage the base context to be the current Activity.

Yosef
  • 1,161
  • 15
  • 18