【发布时间】:2023-03-26 23:09:02
【问题描述】:
录音机在我用 Java 编写的 webview 应用程序中不起作用。请帮忙。我不知道如何获得录音许可证。 这是我的代码:
她是完整代码https://drive.google.com/file/d/1Ov5BesMJN7aXF9IGA-mJO0FObIqH4pWr/view?usp=sharing
webView.setWebViewClient(new WebViewClient() {
public void onReceivedError(WebView webView, int errorCode, String description, String failingUrl) {
try {
webView.stopLoading();
} catch (Exception e) {
}
if (webView.canGoBack()) {
webView.goBack();
}
webView.loadUrl("about:blank");
Intent intent2 = new Intent(Main2Activity.this,Connection.class);
startActivity(intent2);
finish();
super.onReceivedError(webView, errorCode, description, failingUrl);
}
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.contains(".pdf")) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url), "application/pdf");
try {
view.getContext().startActivity(intent);
} catch (ActivityNotFoundException e) {
}
}
else {
webView.loadUrl(url);
}
return false;
【问题讨论】:
-
请显示您的代码
-
我添加了代码
标签: java android android-studio