As you may know, it's possible to 'talk to' an Applet via Javascript. I'd like to be able to do this with my MIDlet. One way would be to use the Method type and do something like this in javascript:
What's odd is that if I go fishing for what methods *are* available, I get the main MIDlet ones:
method: public void Hecl.startApp()
method: public void Hecl.pauseApp()
method: public void Hecl.destroyApp(boolean)
method: public void Hecl.exitApp()
method: public final void javax.microedition.midlet.MIDlet.notifyDestroyed()
method: public final java.lang.String javax.microedition.midlet.MIDlet.getAppProperty(java.lang.String)
method: public final void javax.microedition.midlet.MIDlet.notifyPaused()
...
...
Very weird.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It could be a problem with classloader. Could you prepare code snippet MIDlet that I could easily reproduce your problem and try to isolate the problem.
Bartek
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Seems like there was something else going wrong, as I cleaned up my whole environment and started from scratch. Things started working, so I guess it's not a problem afer all...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
As you may know, it's possible to 'talk to' an Applet via Javascript. I'd like to be able to do this with my MIDlet. One way would be to use the Method type and do something like this in javascript:
foo = document.getElementById("appletid");
foo.callMethod("midletMethodName", "string argument");
This would use 'callMethod' implemented in Main.java, which would then dispatch on the arguments it received.
What do you think?
Thanks,
Dave
I can't figure out why, but it doesn't seem to work. It doesn't recognize methods I put in my MIDlet:
java.lang.NoSuchMethodException: Hecl.runScript(java.lang.String)
I'm attempting to invoke it like so:
Method m = midletClass.getMethod("runScript", new Class[] {String.class});
m.invoke(midlet, new Object[] {methodArg});
from within Main.java in the microemulator code.
In my MIDlet, runScript is done like this:
public void runScript(String s) {
try {
interp.eval(new Thing(s));
} catch (Exception e) {
System.err.println("Error in runScript: " + e);
}
}
So I'm really at a loss as to why microemulator can't see it...
What's odd is that if I go fishing for what methods *are* available, I get the main MIDlet ones:
method: public void Hecl.startApp()
method: public void Hecl.pauseApp()
method: public void Hecl.destroyApp(boolean)
method: public void Hecl.exitApp()
method: public final void javax.microedition.midlet.MIDlet.notifyDestroyed()
method: public final java.lang.String javax.microedition.midlet.MIDlet.getAppProperty(java.lang.String)
method: public final void javax.microedition.midlet.MIDlet.notifyPaused()
...
...
Very weird.
It could be a problem with classloader. Could you prepare code snippet MIDlet that I could easily reproduce your problem and try to isolate the problem.
Bartek
Seems like there was something else going wrong, as I cleaned up my whole environment and started from scratch. Things started working, so I guess it's not a problem afer all...