Android致命信号6(SIGABRT)位于0x00000584(代码= -6)webView(KITKAT 4.4.2)

时间:2017-03-29 07:59:56

标签: android webview sigabrt filechooser webchromeclient

我正在尝试在我的网页浏览器中实现我的网页的filechooser。我正在接受' SIGABRT'在我的webview中使用showFileChooser(ValueCallback uploadMsg,String acceptType)时出错。当我从intent获得结果并在回调方法中设置文件路径" ValueCallback.onRecieveValue(' file address here')"。以下是代码段。

        public void showFileChooser(ValueCallback<String[]> uploadMsg, String acceptType) {

        mUploadMessage1 = uploadMsg;
        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.parse("file:"+Uri.fromFile(file).getPath());

        // Camera capture image intent
        final Intent captureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
        captureIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedImageURI);
        Intent i = new Intent(Intent.ACTION_GET_CONTENT);
        i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
        i.addCategory(Intent.CATEGORY_OPENABLE);
        i.setType("image/*");

        // Create file chooser intent
        Intent chooserIntent = Intent.createChooser(i, "Image Chooser");
        // Set camera intent to file chooser
        chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Parcelable[]{captureIntent});
        // On select image call onActivityResult method of activity
        startActivityForResult(chooserIntent, FILECHOOSER_RESULTCODE);


    }

OnActivityresult:

 data.getData();
result = Uri.parse("file:" + getPath(HealthRecord.this, data.getData()));
 mUploadMessage1.onReceiveValue(new String[]{result.toString()});

0 个答案:

没有答案