enter image description here私はそのwebviewのアクティビティでwebviewを使用していますが、タップ可能ですが動作していない戻るボタンが1つあります。任意のアイデアwebviewボタンのこのクリックを処理する方法。webviewのwebview backボタンが前のアクティビティ/ページに移動していません
CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setAcceptCookie(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient() {
ProgressDialog progressDialog =
ProgressDialog.show(activity, Constants.EMPTY_VALUE, Constants.PLEASE_WAIT, true);
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url, headers);
return true;
}
public void onPageStarted(WebView view, String url, Bitmap favicon) {
if (activity != null && progressDialog != null) {
progressDialog.setCancelable(false);
}
updatePaymentUrl = null;
if (url.contains("callback-data")) {
webView.setVisibility(View.GONE);
showpDialog();
int indexQ = url.indexOf("?");
partUrl = url.substring(indexQ + 1, url.length());
speedOrderUpdateApi();
}
if (updatePaymentUrl != null) {
super.onPageStarted(view, updatePaymentUrl, favicon);
} else {
super.onPageStarted(view, url, favicon);
}
}
public void onReceivedError(WebView view, int errorCode, String description,
String failingUrl) {
Logger.logInfo("errorCode = ", String.valueOf(errorCode));
Logger.logInfo("description = ", description);
Logger.logInfo("failingUrl = ", failingUrl);
super.onReceivedError(view, errorCode, description, failingUrl);
}
@Override
public void onPageFinished(WebView view, String url) {
if (activity != null && progressDialog != null) {
if (progressDialog.isShowing()) {
progressDialog.dismiss();
}
// If title not found hide webview
Logger.logInfo("view.getTitle() = ", view.getTitle());
if (view.getTitle() != null && "Not Found".equals(view.getTitle())) {
view.setVisibility(View.INVISIBLE);
Toast.makeText(activity, "Link Not Found", Toast.LENGTH_LONG).show();
}
}
}
});
// Not needed
Random random = new Random(System.currentTimeMillis());
int randomNumber = random.nextInt();
Logger.logInfo("urlTemp = ", url);
webView.loadUrl(url, headers);
}
いいえ。これは解決策ではありません... onKeyDown()ボタンは正常に動作していますが、webViewにはBACKのテキストボタンが1つあります。 –
私の更新を確認してください – Max
これは答えではありません私はwebView.client()のonPagefinished()の中にコードを書くべきだと思います。 –