【发布时间】:2012-06-12 19:33:09
【问题描述】:
它只是不工作。
我正在这样做
webView.setWebChromeClient(new WebChromeClient() {
public void openFileChooser(ValueCallback<Uri> uploadFile) {
System.out.println("openFileChooser");
mUploadMessage = uploadFile;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("file/*");
PresentationActivity.this.startActivityForResult(
Intent.createChooser(i, "Image Browser"),
FILECHOOSER_RESULTCODE);
}
});
但是 openFileChooser 永远不会被调用。 有任何想法吗? openFileChooser 在 Android 源代码中被标记为 @hide。 我认为这是因为你不应该使用这种方法。还有另一种可能打开文件选择器吗??
【问题讨论】:
-
对于 Android 3.0+,您需要实现不同的方法:stackoverflow.com/questions/5907369/file-upload-in-webview