尝试在Android中的WebView打开选择标记的应用程序崩溃 [英] Trying to open SELECT tag in Android WebView crashes the application

查看:173
本文介绍了尝试在Android中的WebView打开选择标记的应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

A <一个href=\"http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=0CC0QFjAB&url=http://stackoverflow.com/questions/4697908/html-select-control-disabled-in-android-webview-in-emulator&ei=5NgzT9T4LYnb0QW85fGlAg&usg=AFQjCNH2zpDiUCCJDekb8iL-WY4J9qSOvw&sig2=GX73w8jNQopdCYdDJDjQYw\"相对=nofollow>类似的问题被问及一年前,并没有完全解决,但我要去尝试我的运气,无论如何,也许有人知道这一点。

A similar question was asked about a year ago, and wasn't quite resolved, but I'm gonna try my luck anyhow, maybe someone knows this.

我有这样的应用程序,它运行夫妇在WebView中的HTML页面。一切看起来都不错,工作原理确定,直到您尝试打开一个SELECT标签 - 繁荣,应用程序崩溃。
这里有一个跟踪栈,如果这能帮助:

I have this application that runs a couple of HTML pages in a WebView. Everything looks nice and works OK, until you try to open a SELECT tag - boom, application crashes. Here's a trace stack, if this helps:

主题[&LT; 1>主](暂停(例外窗口管理$ BadTokenException))
      AlertDialog(对话).show()行:247结果
      的WebView $ InvokeListBox.run()行:7841结果
      的WebView $ PrivateHandler(处理器).handleCallback(消息)线:587结果
      的WebView $ PrivateHandler(处理器).dispatchMessage(消息)行:92结果
      Looper.loop()行:130
      ActivityThread.main(字符串[])行:3859结果
      Method.invokeNative(对象,对象[],上课,下课[],类,整型,布尔)行:不可用[本机方法]结果
      Method.invoke(对象,对象...)线:507结果
      ZygoteInit $ MethodAndArgsCaller.run()行:840结果
      ZygoteInit.main(字符串[])线:598
      NativeStart.main(字符串[])行:不可用[本机方法]

Thread [<1> main] (Suspended (exception WindowManager$BadTokenException)) AlertDialog(Dialog).show() line: 247
WebView$InvokeListBox.run() line: 7841
WebView$PrivateHandler(Handler).handleCallback(Message) line: 587
WebView$PrivateHandler(Handler).dispatchMessage(Message) line: 92
Looper.loop() line: 130 ActivityThread.main(String[]) line: 3859
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 507
ZygoteInit$MethodAndArgsCaller.run() line: 840
ZygoteInit.main(String[]) line: 598 NativeStart.main(String[]) line: not available [native method]

(这是什么AlertDialog与打开一个选择框做的是超越我。不,没有到打开警报的SELECT相关脚本)。

(What does AlertDialog have to do with opening a select box is beyond me. And no, there's no script associated with the SELECT that opens an Alert).

现在,这里是最好的部分。我与OS 2.3.5 2的设备,三星Galaxy S2与OS 2.3.3,以及摩托罗拉RAZR XT910测试应用。三星一切正常的精彩。上RAZR,但是,上述情况发生。

Now, here's the best part. I'm testing the app on 2 devices, Samsung Galaxy S2 with OS 2.3.3, and Motorola RAZR XT910 with OS 2.3.5. On Samsung everything works wonderful. On RAZR, however, the above happens.

该页面是pretty沉甸甸的CSS和JavaScript,但即使一切都去掉它的崩溃。事实上,一个SELECT控制一个空的HTML仍然崩溃。

The pages are pretty heavy with CSS and JavaScript, but it's crashing even if everything is removed. In fact, an empty HTML with a single SELECT control still crashes. A few things mentioned in the question from year ago that I did try:


  • 删除从HTML所有绝对和固定定位元素(其实我删除整个CSS只是为了看看是否有任何影响 - 事实并非如此)。

  • 确保SELECT写入由这本书,没有虚假属性/标签。

没有什么帮助。

有没有人有丝毫的线索,什么可能导致此?

Does anyone have the slightest clue as to what might be causing this?

推荐答案

寻找所有网站上了一个多月后,我已经放弃了和转发都选用天然code。

After looking all over the web for over a month, I've given up and relayed all SELECTs to native code.

的东西,看起来像SELECT,绑定click处理程序会启动方法上 JavascriptInterface 替换SELECT和传递的SELECT选项值吧,让方法打开对话框 RadioGroup中,填写与单选取值重新组presenting的选项。选中后,解决了指标,并将其传递回给JavaScript。

Replace the SELECT with something that looks like SELECT, bind click handler that launches a method on JavascriptInterface and pass the SELECTs option values to it, let the method open a Dialog with a RadioGroup, fill the group with RadioButtons representing the options. When selected, resolve the index and pass it back to the JavaScript (the SELECT instance that launched the process should be saved in some var first).

这是丑陋的地狱,但遗憾的是没有别的似乎工作。

This is ugly as hell, but sadly nothing else seemed to work.

这篇关于尝试在Android中的WebView打开选择标记的应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆