Could you please explain it in detail? I overrided deactivate(), but I have no idea how implement it to catch event. My Application source code is below, it's pretty simple. Have I missed something ?
PHP Code:
package AppHello;
import net.rim.device.api.system.KeyListener;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Keypad;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.RichTextField;
import net.rim.device.api.ui.container.MainScreen;
public class HelloWorld extends UiApplication {
private BackGroundApp backGroundApp;
private HelloWorldScreen mScreen;
private HelloWorld() {
mScreen = new HelloWorldScreen();
pushScreen(mScreen);
}
}
/**
* @param args
*/
public static void main(Stringxxx91;xxx93; args) {
// TODO Auto-generated method stub
HelloWorld app = new HelloWorld();
app.enterEventDispatcher();
}
public void deactivate() {
// TODO Auto-generated method stub
super.deactivate();
}
}
final class HelloWorldScreen extends MainScreen
{
HelloWorldScreen()
{
setTitle(new LabelField("BBerry",LabelField.ELLIPSIS));
add(new RichTextField("Config Screen",Field.NON_FOCUSABLE));
}
public void close() {
// TODO Auto-generated method stub
Dialog.alert("Bye");
System.exit(0);
super.close();
}
protected boolean keyDown(int arg0, int arg1) {
// TODO Auto-generated method stub
Dialog.alert(String.valueOf(Keypad.key(arg0)));
System.out.println(String.valueOf(Keypad.key(arg0)));
return super.keyDown(arg0, arg1);
}
protected boolean keyChar(char c, int status, int time) {
// TODO Auto-generated method stub
return super.keyChar(c, status, time);
}
}