Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Contributor
djpinto
Posts: 41
Registered: ‎11-15-2012
My Carrier: Optimus
Accepted Solution

How to get event "button back"

Hello,

 

How to create one event for where to pressed button back?

 

I some test the examples but never running!

 

cumps

Please use plain text.
Developer
peter_strange
Posts: 17,722
Registered: ‎07-14-2008

Re: How to get event "button back"

I am not sure what you mean by button back.

 

If you want to know when a Button is pressed, then you are best coding a FieldChangedListener for the Button. 

 

Let us know if this is not enough information for you.

Please use plain text.
Contributor
djpinto
Posts: 41
Registered: ‎11-15-2012
My Carrier: Optimus

Re: How to get event "button back"

Button back is the button with the back arrow.

Please use plain text.
Developer
peter_strange
Posts: 17,722
Registered: ‎07-14-2008

Re: How to get event "button back"

If you are using the MainScreen, then you can override keyChar, and look for the ESCAPE character.  here is some sample code:

 

        protected boolean keyChar(char character, int status, int time) {
            // regardless of where we are, Esc will exit
            switch (character) {
                case Characters.ESCAPE:
                    close();
                    return true;
                default:
                    return super.keyChar(character, status, time);
            }
        }

 

Please use plain text.
Contributor
djpinto
Posts: 41
Registered: ‎11-15-2012
My Carrier: Optimus

Re: How to get event "button back"

Yes, this is it!

 

Thanks

Please use plain text.