我在网页上有一个文件上传控件,并在webview中显示它。但是选择文件不起作用。没有作用。我为此使用以下代码:
webView = (WebView) findViewById(R.id.wbvw);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(url);
webView.setWebChromeClient(new WebChromeClient()
{
//The undocumented magic method override
//Eclipse will swear at you if you try to put @Override here
// For Android 3.0+
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
WebviewActivity.this.startActivityForResult(Intent.createChooser(i,"File Chooser"), FILECHOOSER_RESULTCODE);
}
// For Android 3.0+
public void openFileChooser( ValueCallback uploadMsg, String acceptType ) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("*/*");
WebviewActivity.this.startActivityForResult(
Intent.createChooser(i, "File Browser"),
FILECHOOSER_RESULTCODE);
}
//For Android 4.1
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/*");
WebviewActivity.this.startActivityForResult( Intent.createChooser( i, "File Chooser" ), WebviewActivity.FILECHOOSER_RESULTCODE );
}
});
我尝试使用调试器运行代码,但是webView.setWebChromeClient
中的方法不起作用。
答案 0 :(得分:0)
使用此:
val arr = df.select($"column".cast("Double")).as[Double].rdd.collect
此代码应该有效! 我尝试了代码,没有问题。[Sony Z3 / android:6.0.1]和[荣誉3c / android:4.1.1]。
资料来源:Github <==我编辑了此代码[将片段更改为活动]供您使用!
祝你好运。