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
Contributor
sunaina
Posts: 10
Registered: ‎01-16-2013
My Device: BB7 and BB10

Back button to go back to previous screen and close button on menu to exit the app

Hello,

 

I am developing an application for BB os 7.1 using eclipse plugin.

 

I have used

public boolean onClose(){
        int response = Dialog.ask(Dialog.D_YES_NO,
            "Are you sure you want exit?");
        if (response == -1)
        {
            return false;
        } else
        {
            System.exit(0);
            return true;
        }
    }

 

 

Suppose i am in screen 3 and click on back button, i must go back to screen 2 but now i get pop up for exiting the screen and also when i click on menu--> close i get the popup for exiting the app..

 

My requirement is to go back to the previous screen on click of back button and when i click menu--> close I must get a pop up for exiting the app.

 

I hope I am clear about my question.

 

Can anybody please help me out on this

 

 

Thanks in advance

 

 

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

Re: Back button to go back to previous screen and close button on menu to exit the app

Unfortunately I don't think that Close and onClose can distinguish between the back button and the Close menu item. So I think the only option you have to to provide your own close menu item that has the functionality that you want, replacing the System generated one.

 

But in fact I would not recommend that you do that.  BB users expect both the back button and menu-->close to take them back one screen. So if you wish to give the BB user the option to exit the application then provide your own Exit menu item.  Let Close and back do what they normally do.