Cannot resolve method 'setWebChromeClient(anonymous android

给你一囗甜甜゛ 提交于 2019-12-25 19:06:03

问题


I am trying to learn building applications for Android and the first project is to view a website I've made that uses GPS localization. But when I'm trying to use webView.setWebChromeClient(... I'm getting the following error message: Cannot resolve method 'setWebChromeClient(anonymous android.webkit.WebChromeClient).

If it will help anything, I have added the needed permissions in my AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

How can I fix this?


回答1:


Delete the wrong static import on line 13 and move the call to line 31 after assigning a view to the local variable:

WebView view = findViewById(R.id.webView)
view.setWebChromeClient(...)


来源:https://stackoverflow.com/questions/43726302/cannot-resolve-method-setwebchromeclientanonymous-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!