Hi all,

I'm sorry to bother people with this (blame Google for not having
documentation), but I have run into a snag whilst trying to invoke a
method from javascript. I am loading my own html and all that, that's
not the problem. JavaScript works fine, too, I have other scripts
running perfectly (which do not require Java objects), so it is
obviously in the way I am trying to call the methods (right?). The
only example I have seen of this process uses something called a
BrowserCallbackAdapter, which does not exist(?). At least, if it does,
Google decided to mention a grand total of one times in the entire
online reference, and only to say:

"Provides tools for browsing the web.

The only classes or interfaces in this package intended for use by SDK
developers are WebView, BroswerCallbackAdapter, BrowserCallback, and
CookieManager."
at http://developer.android.com/reference/android/webkit/package-descr.html

which is all well and good except that that's it. All of it from
everywhere. So DOES it exist? If it does, then what the hell am I
supposed to take from that (incredibly information-devoid) blurb? How
do I USE a "BroswerCallbackAdapter"(exactly as spelled at link, though
I imagine that's a typo) and have success with the JavaScript to Java
thing? Here is my code (without the apparently not-actually-real
BrowserCallbackAdapter):

MainActivity.java:

Webview view;
MediaPlayer.mp

public void onCreate(blah){
blah blah blah...
        view=new WebView(this);
        view.getSettings().setJavaScriptEnabled(true);
        view.getSettings().setJavaScriptCanOpenWindowsAutomatically
(false);
        view.getSettings().setPluginsEnabled(true);
        view.getSettings().setSupportMultipleWindows(false);
        view.getSettings().setSupportZoom(false);
        view.setVerticalScrollBarEnabled(true);
        view.loadUrl("file:///android_asset/first.html");
        mp=MediaPlayer.create(this,R.raw.ring);
        view.addJavascriptInterface(mp, "mp");

first.html:

       /*I'm not bothering with head and body. The display works
perfectly and I have other working          JavaScript, so it's not a
typo with any of that. The essentials are below*/

<script type="text/javascript">
function unhide(divID) {
    var item = document.getElementById(divID);
    if (item) {
        item.className=(item.className=='hidden')?'unh
function playsound() {
    window.mp.start();
}
</script>
<input id="id" name="name" type="Button" value="カエル:"
onClick="javascript:playsound();"/>


I have tried my damndest to figure this one out by my lonesome, but I
am at a complete loss. If anything I did is not correct, it is because
there is no documentation findable by a single search engine in
current existence or the 500 (almost literally) other combinations and
variations of basically the same code didn't work either. I feel like
there should be a way to do this, seeing as the online Android
reference says it can, just not how exactly. Maybe it's a secret?
Thank you so much to whoever the kind soul is that can alleviate this
headache of mine.

Seriously, thank you very much.

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

Reply via email to