Android webview输入照片按钮不起作用

时间:2016-08-02 20:06:39

标签: java android input webview

我正在使用Android Webview项目,我需要访问我的设备照片和视频,但我的按钮不起作用,我没有收到任何错误消息。

这是我的HTML代码:

<strong>Send Photo</strong>
<input type="file" accept="image/*" id="capture" capture="camera" name="txFile">
<br>            
<strong>Send Video</strong>
<input type="file" accept="video/*" id="capture" capture="camcorder" name="txFile2">

这是我的Java代码:

myWebView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
myWebView.getSettings().setAppCachePath( getApplicationContext().getCacheDir().getAbsolutePath() );
myWebView.getSettings().setAllowFileAccess( true );
myWebView.getSettings().setAppCacheEnabled( true );
myWebView.getSettings().setJavaScriptEnabled( true );
myWebView.getSettings().setDomStorageEnabled(true);
myWebView.addJavascriptInterface(this,"Exemplo");
myWebView.getSettings().setAllowFileAccess(true);
myWebView.getSettings().setCacheMode( WebSettings.LOAD_DEFAULT ); // load online by default

if ( !isNetworkAvailable() ) { // loading offline
    myWebView.getSettings().setCacheMode( WebSettings.LOAD_CACHE_ELSE_NETWORK );
}

This is how to show in Emulator

我很感激你的每一个帮助!

0 个答案:

没有答案