Java Reference
In-Depth Information
public void add_location( String l ) {
String locations[];
int i;
try {
locationStore.addLocation( new Location( l, "" ));
locationList = null;
} catch (Exception e) {
getDisplay().setCurrent(get_cannotAddLocationAlert(),
get_locationList());
}
// Refresh the location list lazily.
}
Showing an Alert is a little different than showing other Displayable s, because you
need to specify the Displayable that the screen should show after showing the Alert .
Consequently, you use the Display.setCurrent method, which takes both an Alert and
a subsequent form, like this:
Display.getDisplay().setCurrent( alert, nextForm );
Interestingly, you can set your own CommandListener on an Alert using
setCommandListener , but be careful if you do: it disables the autoadvance feature that
takes the screen to the next Displayable either when the user dismisses the Alert or
its timer expires. To restore this functionality, just set a CommandListener of null .
The Alert class has the usual gamut of accessor and mutator methods you'd expect,
including the following:
setTimeout and getTimeout : Set and get the time-out until the Alert transitions to
the next Displayable
setImage and getImage : Set and get the Image instance displayed by the Alert
setString and getString : Set and get the string (not the title!) displayed by the Alert
setIndicator and getIndicator : Set and get the gauge displayed by the Alert
Tip If you set a Gauge for an Alert , it must be noninteractive, not owned by another Displayable , and
not have any commands or label, and its layout value must be LAYOUT_DEFAULT .
 
Search WWH ::




Custom Search