webview文件上传无效

时间:2017-07-10 08:44:25

标签: android

我已经查看了#view; webview文件加载'从堆栈溢出发布 但是我没有显示任何弹出窗口。请仔细看看

假设我有以下html代码来访问android库。

 <form method="POST" enctype="multipart/form-data">
File to upload: <input type="file" name="uploadfile">&nbsp;&nbsp;
<input type="submit" value="Press to Upload..."> to upload the file!
</form>

我实施了onCreate之后。当我点击文件上传按钮时。它没有打开任何东西。但它只显示了

D/mali_winsys: new_window_surface returns 0x3000,  [1440x2560]-format:1

这是一条错误消息。
以下是onCreate的代码

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        web  = (WebView)findViewById(R.id.webView);

        ln1=(LinearLayout) findViewById(R.id.ln1);

        WebSettings settings =  web.getSettings();
        settings.setJavaScriptEnabled(true);

        web.loadUrl("http://github.tkddnjsdja.tk/");
        web.setWebViewClient(new myWebClient());

        web.setWebChromeClient(new WebChromeClient(){

            public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
                mUploadMessage = uploadMsg;
                Intent i = new Intent(Intent.ACTION_GET_CONTENT);
                i.addCategory(Intent.CATEGORY_OPENABLE);
                i.setType("image/*");
                MainActivity.this.startActivityForResult(Intent.createChooser(i, "File Chooser"), MainActivity.FILECHOOSER_RESULTCODE);

            }



        });

        //setContentView(web);

    }

当我点击按钮时,它只显示
并没有改变。有人帮忙吗?

我给了以下权限

 <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>
    <uses-permission  android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
    <uses-permission android:name ="android.permission.CAMERA"></uses-permission>
<uses-permission android:name="android.hardware.camera"></uses-permission>

0 个答案:

没有答案