6

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??

Basic Coder
  • 10,882
  • 6
  • 42
  • 75

1 Answers1

12

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.

Fujix
  • 136
  • 2
  • 3