T
thonbrocket
I havel a method in my main MIDlet that flashes up a message as an
Alert:
public void doAlert(String sAlertText) {
Alert alSending;
alSending = new Alert(null, sAlertText, null, AlertType.INFO);
alSending.setTimeout(3000);
m_display.setCurrent(alSending);
}
m_display is declared and instantiated in the main MIDlet:
public class Boss extends MIDlet implements CommandListener {
public static Display m_display;
public Boss() { /** Constructor*/
m_display = Display.getDisplay( this );
}
.............
}
Now when I try to call this from another class:
new Boss().doAlert("Eat lead, Bambi!");
I get: "SecurityException: Application not authorized to access the
restricted API". The same happens if I try to use a reference to a
MIDlet, rather than to a Display. Apparently, you can't instantiate a
MIDlet from with another MIDlet / class.
So, how do you obtain a reference to the currently-running MIDlet or
its Display from a different class?
Alert:
public void doAlert(String sAlertText) {
Alert alSending;
alSending = new Alert(null, sAlertText, null, AlertType.INFO);
alSending.setTimeout(3000);
m_display.setCurrent(alSending);
}
m_display is declared and instantiated in the main MIDlet:
public class Boss extends MIDlet implements CommandListener {
public static Display m_display;
public Boss() { /** Constructor*/
m_display = Display.getDisplay( this );
}
.............
}
Now when I try to call this from another class:
new Boss().doAlert("Eat lead, Bambi!");
I get: "SecurityException: Application not authorized to access the
restricted API". The same happens if I try to use a reference to a
MIDlet, rather than to a Display. Apparently, you can't instantiate a
MIDlet from with another MIDlet / class.
So, how do you obtain a reference to the currently-running MIDlet or
its Display from a different class?