Displaying info in a non-MIDlet class
Hi,
I have a class which doesn't extend MIDlet class, and i would like to print some info on the screen (not on the standard output), but in that class i don't have references to the MIDlet which is executing it, nor references to that MIDlet's display. I know this sounds a little weird, but i don't have control of the MIDlet that is executing my code because it is some kind of platform that starts executing my code by itself.
I thought that if my class extended MIDlet class, i should be able to show an alert message (that's what i am trying, in fact), but it didn't work (probably because that MIDlet is never started, its code is executed instead).
My code looks like:
publicclass Viewextends MIDlet{
private Alert messages;
View(){
}
publicvoid writeMessage(String message){
messages =new Alert("Agent Contractor");
messages.setTimeout(Alert.FOREVER);
messages.setString(message);
messages.setType(AlertType.INFO);
Display.getDisplay(this).setCurrent(messages);
// messages.IsShown() returns false
}
publicvoid destroyApp(boolean o){}
publicvoid pauseApp(){}
publicvoid startApp(){}
}
IsShown returns false, so i think this is not working :)
So, is there a way of showing some messages on the phone's display without knowing the Display reference nor the MIDlet reference? Maybe should i try to get my MIDlet reference? but how?
I'm using J2MEWT, and the DefaultColorPhone emulator.
Thanks in advance,
David.

