小编pam*_*609的帖子

Android文件选择器不是从Lollipop中的WebView或Marshmallow打开的

我正在开发一个应用程序,它使用a WebView来访问某些逻辑.逻辑,有一个用户可以上传图片的部分,但是,我似乎找不到应用程序这样做的方法.
我正在使用的代码就是这个链接.

正如您将看到的那样,自定义Intent设置WebChromeClient,然而,文件选择器根本不打开.码:

public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType){  

                // Update message
                mUploadMessage = uploadMsg;

                try{    

                    // Create AndroidExampleFolder at sdcard

                    File imageStorageDir = new File(
                                           Environment.getExternalStoragePublicDirectory(
                                           Environment.DIRECTORY_PICTURES)
                                           , "AndroidExampleFolder");

                    if (!imageStorageDir.exists()) {
                        // Create AndroidExampleFolder at sdcard
                        imageStorageDir.mkdirs();
                    }

                    // Create camera captured image file path and name 
                    File file = new File(
                                    imageStorageDir + File.separator + "IMG_"
                                    + String.valueOf(System.currentTimeMillis()) 
                                    + ".jpg");

                    mCapturedImageURI = Uri.fromFile(file); 

                    // Camera capture image intent
                    final …
Run Code Online (Sandbox Code Playgroud)

android webview android-afilechooser

2
推荐指数
2
解决办法
7355
查看次数

标签 统计

android ×1

android-afilechooser ×1

webview ×1