如何在android中检测webview中的点击? [英] How to detect clicks in webview in android?

查看:108
本文介绍了如何在android中检测webview中的点击?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法检测网页浏览中的点击次数?



我在我的Android应用程序中打开一个网站,我想在应用程序中显示特定点击次数的广告。那么,无论如何呢?我可以检测用户是否已点击?并根据点击我可以向他们展示广告?



我尝试过:



我应该添加什么代码来检查用户是否在网页浏览中点击了?

我不知道如何检测它,因为没有我手动放置的按钮所有材料都是网站

is there any way to detect the clicks in the webview?

I am opening a website in my android app and I want to show ads on the specific number of clicks in the app. So, is there anyway? I can detect whether the user has clicked or not? and based on click I can show ads to them?

What I have tried:

what code should I add to check whether the user has clicked or not in the webview?
I don't know how to detect it because there is no button that i have placed manually all the material is of website

推荐答案

您可以通知点击这样的链接:



You can be notified about clicking on links like so:

webView.setWebViewClient(new WebViewClient() {
  @Override
  public boolean shouldOverrideUrlLoading(WebView view, String url) {
    // The webView is about to navigate to the specified url.	
    return super.shouldOverrideUrlLoading(view, url);
  }
});


这篇关于如何在android中检测webview中的点击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆