Friday, April 27, 2012

Override Back Key in BlackBerry


        public boolean keyChar(char key, int status, int time)
        {
                boolean retval = false;
                if(key == Characters.ESCAPE)
                {
                        retval = true;
                        int response = Dialog.ask(Dialog.D_YES_NO, "Do you really want exit??");
                        if(response == Dialog.YES)
                                System.exit(0);
                }
                else if(key == Characters.ENTER)
                {
                        navigationClick(status, time);
                        return true;
                }
                else
                {
                        retval = super.keyChar(key,status,time);
                }
                return retval;
        }

No comments:

Post a Comment