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
laurentC
Posts: 266
Registered: ‎02-05-2010
My Device: Blackberry Z10
My Carrier: Bouygues Telecom

Close and do something...

Hi,

Can someone tell me if it's possible to close a mainscreen in its navigationClick method please ?

 

In my app, when the user click on a screen, I need to close the screen (actually the app) and visit a website for example.

 

Do I write : close();

Browser.visit...

 

or do I write :

Browser.visit...

close();

 

thanks, Laurent

Twitter : @LaurentKP
My apps
Please use plain text.
Developer
carlostheone
Posts: 151
Registered: ‎01-20-2010
My Device: Blackberry Bold
My Carrier: Telefonica

Re: Close and do something...

to close a screen, you can use:

 

UiApplication.getUiApplication().popScreen(yourScreen);

 

and next you can invoke the browser.

 

Ps: sorry for my english.

 

 

Please use plain text.
Developer
jitendrasharma
Posts: 208
Registered: ‎08-04-2009
My Device: Not Specified

Re: Close and do something...

you will need to execute following code:

UiApplication.getUiApplication().popScreen(this);

Browser.getDefaultSession().displayPage(String pageUrl);

 

in navigationClick() method of main screen.

Please use plain text.
Developer
laurentC
Posts: 266
Registered: ‎02-05-2010
My Device: Blackberry Z10
My Carrier: Bouygues Telecom

Re: Close and do something...

Thank you. 

 

It seems to me I should use :

UiApplication.getUiApplication().popScreen(this);

 

instead of :

close();

 

I'll try this code.

Thanks again.

 

Laurent

 

Twitter : @LaurentKP
My apps
Please use plain text.
Developer
Ebscer
Posts: 846
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon

Re: Close and do something...

[ Edited ]

The simpliest way to do this is to overide the screens own close method such as

 

 

MainScreen _screen = new MainScreen()
        {
            public void close()
            {
                Browser.getDefaultSession().displayPage("http://ebscer.com");
                super.close();
            }
        };

 

 


Read my thoughts on BlackBerry Development at news.ebscer.com
Please use plain text.
Developer
laurentC
Posts: 266
Registered: ‎02-05-2010
My Device: Blackberry Z10
My Carrier: Bouygues Telecom

Re: Close and do something...

I'm facing the same issue with

UiApplication.getUiApplication().popScreen(this);

or close();

The application is send to background and blocked. I can't open it again !

 

My main screen is a popupScreen, not a mainscreen.

Should I  overwrite the close method in my own class ?

 

Twitter : @LaurentKP
My apps
Please use plain text.