DisplayErrorpublic class DisplayError extends Object Displays error messages using the Display instance object passed
into the Constructor. |
Fields Summary |
---|
Display | displayThe display instance to be used to display error alerts |
Constructors Summary |
---|
DisplayError(Display display)Creates a DisplayError instance given a display object.
this.display = display;
|
Methods Summary |
---|
void | showCorruptedSuiteAlert(java.lang.String msg)Display an alert screen when midlet suite is corrupted
Alert a = new Alert(Resource.getString
(ResourceConstants.AMS_CANT_ACCESS),
msg, null, AlertType.ERROR);
a.setTimeout(2000);
display.setCurrent(a, display.getCurrent());
| void | showErrorAlert(java.lang.String appName, java.lang.Throwable t, java.lang.String alertTitle, java.lang.String alertMessage)Display the Alert with the error message.
showErrorAlert(appName, t, alertTitle, alertMessage, null);
| void | showErrorAlert(java.lang.String appName, java.lang.Throwable t, java.lang.String alertTitle, java.lang.String alertMessage, Displayable nextDisplayable)Display the Alert with the error message.
if (alertMessage == null) {
if (t instanceof MIDletSuiteLockedException) {
String[] values = new String[1];
values[0] = appName;
alertMessage = Resource.getString(
ResourceConstants.AMS_MGR_UPDATE_IS_RUNNING,
values);
} else if (t instanceof MIDletSuiteCorruptedException) {
String[] values = new String[1];
values[0] = appName;
alertMessage = Resource.getString(
ResourceConstants.AMS_MIDLETSUITE_ID_CORRUPT_MSG,
values);
} else {
t.printStackTrace();
StringBuffer sb = new StringBuffer();
sb.append(appName);
sb.append("\n");
sb.append(Resource.getString(ResourceConstants.ERROR));
sb.append(": ");
sb.append(t.toString());
alertMessage = sb.toString();
}
}
if (alertTitle == null) {
alertTitle =
Resource.getString(ResourceConstants.AMS_CANNOT_START);
}
Alert a = new Alert(alertTitle, alertMessage, null, AlertType.ERROR);
a.setTimeout(Alert.FOREVER);
if (nextDisplayable == null) {
display.setCurrent(a);
} else {
display.setCurrent(a, nextDisplayable);
}
|
|