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.

inside custom component

Java Development

Reply
Developer
Posts: 57
Registered: ‎05-04-2009
My Device: 9550
My Carrier: Verizon
Accepted Solution

pop MainScreen

I have what I think is a very simple question - I have an app that uses MainScreen and I have a ButtonField that I would like to pop the screen when it is pressed.  i.e. shift focus back to the home screen - the same way pressing the red call end does it.  I have a listener for that button, and have tried various pop screen schemes, but each have locked that app up with a loss of focus.  Thanks in advance!

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: pop MainScreen

Interested to know what you have tried.

 

You have two choices:

 

a) Put the app in the Background, just do:

UiApplication.getUiApplication().requestBackground();

 

b) Shut the app down

UiApplication.getUiApplication.popScreen(UiApplication.getUiApplication().getActiveScreen());

System.exit(0);

 

A popScreen of the last MainScreen will cause System.exit, provided you haven't overridden something that called on the way and not called super.....  I think onClose() or close() are the methods involved,  But I've always overridden close() and do the above when I want to app to go.

Developer
Posts: 57
Registered: ‎05-04-2009
My Device: 9550
My Carrier: Verizon

Re: pop MainScreen

UiApplication.getUiApplication().requestBackground() did the trick - thanks.