Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
378 views
in Technique[技术] by (71.8m points)

gps - Cannot resolve method 'setWebChromeClient(anonymous android

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?

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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(...)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...