Is is possible to call main activity’s methods from the JavaScript interface of a WebView object? Or to access SharedPreferences from this interface so I could read the data with my activity? I would like to let my Activity know that a specific JavaScript action occured.
Is is possible to call main activity’s methods from the JavaScript interface of a
Share
Yes, two way communication between JavaScript and your application is possible through
WebView.addJavascriptInterface(). Check this example:http://android-developers.blogspot.com/2008/09/using-webviews.html