user468311
user468311

Reputation:

Running Webkit engine on the Application level

I've got several Activities, that need to access JS code, running in WebView. I need that JS code and it's state to be accessible from everywhere, so I was thinking maybe I can run Webkit engine in my application class, and supply data from it to webview and to other components of my app?

Upvotes: 0

Views: 272

Answers (1)

HefferWolf
HefferWolf

Reputation: 3924

What about moving all general accessible state to a javascript interface in java which you register using the javascript bridge:

    webView.addJavascriptInterface(new JsBridge(), "jsbridge");

I use this to transfer data from javascript to my android/java code and back. It doesn't offer a generic interface to access all data but maybe that's still sufficient.

Upvotes: 1

Related Questions