9

I am building a mobile application which should be interacted from java to javascript.

I found the solution in this link Passing an array of values from Android Activity to JavaScript in a WebView. But my problem is when i declare webview its showing error like

None of the methods in the added interface have been annotated with @android.webkit.JavascriptInterface; they will not be visible in API 17

What should I do to remove this error? I am very new to this core java. Please suggest me and help me to solve this problem.

1
  • Did you solve this problem? Commented Jun 9, 2020 at 6:19

1 Answer 1

7

From the docs:

Caution: If you've set your targetSdkVersion to 17 or higher, you must add the @JavascriptInterface annotation to any method that you want available your web page code (the method must also be public). If you do not provide the annotation, then the method will not accessible by your web page when running on Android 4.2 or higher.

Please take a look here http://developer.android.com/guide/webapps/webview.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.