Cannot resolve method 'setWebChromeClient(anonymous android
Asked Answered
C

1

-2

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

Cracking answered 1/5, 2017 at 20:47 Comment(0)
L
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(...)
Lusitania answered 1/5, 2017 at 20:58 Comment(5)
Thank you. But then it complains about the line I removed that was on line 13. i.imgur.com/rzzFkXP.jpgCracking
Type the full view id: findViewById(R.id.webView) instead of findViewById(webView).Lusitania
Thanks. But now it complains on view in view.setWebChromeClient(.... The same error message for origin and callback. And for the GeolocationPermissions.Callback, I get an error message that says Expression expected. i.imgur.com/HGrPfsl.jpgCracking
Try to move your code inside the 'onCreate' method. Currently it's outside the closing bracket.Lusitania
Thanks. That solved it! Now I just have to figure out how to make the application can handle the GPS localization.Cracking

© 2022 - 2024 — McMap. All rights reserved.