|
How to use single listener for more than one screen |
|
|
If a MIDlet has several screens, it can choose to create a single listener
class for each, or it can save even that overhead by subclassing the screen class to implement CommandListener, as follows:
public class MyTextBox extends TextBox implements CommandListener {
public MyTextBox(String title, String text, int maxSize,
int constraints) {
super(title, text, maxSize, constraints);
setCommandListener(this);
// Add Commands (not shown)
}
// Handle command actions
public void commandAction(Command c, Displayable d) {
// Code not shown
}
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.