只是不起作用。
我在做这个
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。
有任何想法吗?在Android源代码中,openFileChooser被标记为@hide。
我认为是因为您不应该使用此方法。还有另一种可能性可以打开fileChooser吗?
最佳答案
openFileChooser的参数已经更新了一些时间。
对于Android 3.0-4.0,它是
public void openFileChooser( ValueCallback<Uri> uploadMsg, String acceptType )
对于4.1
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture)
而对于2.x
public void openFileChooser( ValueCallback<Uri> uploadMsg )
您必须添加所有它们,以支持Android 2.0和4.1之间的任何设备。