It's just NOT working.
I'm doing this
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);
}
});
but openFileChooser is never called. Any ideas? openFileChooser is marked @hide in Android source code. I think its because you should NOT use this method. Is there another possibility to open a fileChooser??
Parameters for openFileChooser have been updated some times.
For Android 3.0 - 4.0, it is
public void openFileChooser( ValueCallback<Uri> uploadMsg, String acceptType )
for 4.1,
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture)
and for 2.x
public void openFileChooser( ValueCallback<Uri> uploadMsg )
You'll have to add all of them to support any devices between Android 2.0 and 4.1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With