Hi,
 
I am trying to execute a javascript function and return a value to java in 
Android 2.3 simulator.
 
I have a class:
 
*package com.myDomain.myPk;*
*public class JSReturn {
 public void returnResult(int ret)
 {
  Log.d("js",String.valueOf(ret));
 }
}*
 
I try to run from my activity:
 
*JSReturn jr=new JSReturn(m_eventForm);
WebView wv=new WebView(m_eventForm);
wv.getSettings().setJavaScriptEnabled(true);
wv.addJavascriptInterface(jr, "myJR");
wv.loadUrl("javascript: myJR.returnResult(5);");*
 
 
I get in logcat "dalvikvm"->"VM aborting" and the activity terminates.
I have tryed a million things and can't figure it out.
If I call: 

*wv.loadUrl("javascript: myJRx.returnResult(5);");*

I get a reference error that is correct.

Anyone knows the problem or a different way to get a result back from 
Javascript?

Thanks

Filipe Madureira

 

-- 
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