我有一个网址(www.abc.com),我在我的应用程序中的一个活动的网页视图中打开了它。我想开发一个流程,这样当用户在webview中浏览URL到webview中的特定URL时,比如说www.abc.com/foo,那么应用程序应该处理它并打开一个特定的活动。如何根据URL的当前值捕获URL并打开特定的活动
任何帮助都将不胜感激。提前感谢
发布于 2020-05-22 10:29:29
,这对我有用,
创建一个webClient并重写onPageFinished方法,以便在加载每个页面后获得URL的当前值
wv_content.webViewClient = object : WebViewClient() {
override fun onPageFinished(view: WebView?, url: String?) {
Log.v("Current value of URL: ", URL)
//handle URL like open an activity based on the value of URL
handleCurrentUrl(url)
super.onPageFinished(view, url)
pb_loading.visibility = View.GONE
}
}https://stackoverflow.com/questions/61941671
复制相似问题