You can bind Java code from within your JavaScript by calling
*WebView.addJavascriptInterface()*. In other words you could call one
method within Java object of your choosing, when user selects A in UI
or different method of different object, when user interacts with UI
differently.

JavaDocs are poor, but fairly good example can be found here:
http://mobile.tutsplus.com/tutorials/mobile-web-apps/build-a-contacts-application-with-jquery-mobile-the-android-sdk-part-1/
 (have a look at section 'Integrating HTML/JavaScript Based UI With
Android Java Back-end')


HTH

Daniel







On 18 January 2012 17:21, Streets Of Boston <[email protected]> wrote:
> It's from a separate class (runJS does something like
> mWebView.loadUrl(javaScriptUrl);)
>
> In my sample code, the run and runJS are usually executed on the main UI
> thread (that's why there the await call has a (short) timeout).
> The WebView's JavaScript execution's callback to Java (setValue in your
> example) is done on a separate thread (managed by the WebView, i suppose).
>
> If you use my code, does the call to 'latch.await' time-out?
>
> If so, this means that the WebView never properly loaded the url (code) in
> the loadUrl call. Look at your LogCat and see what may be the problem.
>
> Note that the WebView we use returns false for it's
> WebViewClient's shouldOverrideUrlLoading method.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
Daniel Drozdzewski

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to