4

I wrote new example similar to WebView Demo and registered my Java object with addJavascriptInterface() to webview. and in Java script I am able to call java methods.

Later, I modified android browser code and tried to add Object to javascript,in a same way. but object members are not accessible in javascript and I get runtime error like

"Uncaught TypeError: Object com.android.browser.BrowserActivity$MyJavaScriptInterface@43bf7eb8 has no method 'launchPlayer' "

Where as launchPlayer method is available in MyJavaScriptInterface class.

Can anybody tell me what is the difference in Browser app, which stops exporting methods to Javascript.

4
  • Make sure your inner class and the method are both public. Commented Aug 26, 2010 at 11:44
  • Make sure you set your android target SDK version to maximum 15 (or lower). Commented Sep 12, 2013 at 8:37
  • See stackoverflow.com/questions/14031635/… , for >= 4.2.1 add @JavascriptInterface to method Commented Oct 24, 2013 at 17:08
  • 1
    Are you sure parameters are same? Commented Dec 15, 2014 at 6:41

0

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.