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
Trusted Contributor
Posts: 204
Registered: ‎07-14-2010
My Device: 8100
Accepted Solution

how to avoid save discard cancel popup ?

Hi all , 

 

  Am using a Basiceditfield for search option .

the implementation of it is working fine.but if i click 

the back button of the device / simulator i get a popup 

window as save , cancel ,discard ' and if i click any of these

option my application exits, but i need to navigate to 

previous screen or  next screen.

and i should not get this popup window.

 

any ideas , how to fix it ?

Developer
Posts: 468
Registered: ‎08-07-2009
My Device: Curve, Bold, Storm

Re: how to avoid save discard cancel popup ?

hi,

 

Use this

 

    // this is added to avoid the save/discard/cancel dialog box on exit
    public boolean onSavePrompt()
    {
        return true;
    }

----------------------------------------------------------
feel free to press the kudos button on the left side to thank the user that helped you.
please mark posts as solved if you found a solution.
Trusted Contributor
Posts: 204
Registered: ‎07-14-2010
My Device: 8100

Re: how to avoid save discard cancel popup ?

were to use this function ? 

New Developer
Posts: 72
Registered: ‎08-28-2008
My Device: Not Specified

Re: how to avoid save discard cancel popup ?

[ Edited ]

Hello   kirthia

onSavePrompt() function is in Screen class and you have to override this function in your screen class. Return true to avoid save/discard/cancel pop up window.

 

 

Regards,
Vijay Saini.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Trusted Contributor
Posts: 204
Registered: ‎07-14-2010
My Device: 8100

Re: how to avoid save discard cancel popup ?

how to invoke this ? any sample code ?

New Developer
Posts: 72
Registered: ‎08-28-2008
My Device: Not Specified

Re: how to avoid save discard cancel popup ?

You need not to invoke this. it will be invoked by the framework.

Regards,
Vijay Saini.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Developer
Posts: 49
Registered: ‎03-17-2010
My Device: 8900,9000,9530,9500,9700

Re: how to avoid save discard cancel popup ?

You can use this following code in a screen and will not display that prompt again when you click escape button.

 

 

public boolean onSavePrompt() 
{ 
return true; 
}

 

 

just simple code.

pls press accept the solution.

 

Developer
Posts: 468
Registered: ‎08-07-2009
My Device: Curve, Bold, Storm

Re: how to avoid save discard cancel popup ?

hi,

its is called on its own.

 

It just avoids that popup.

 

Add this to your class outside the constructor.

 

 

Regards

Ekansh

----------------------------------------------------------
feel free to press the kudos button on the left side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Posts: 950
Registered: ‎06-22-2010
My Device: 9550

Re: how to avoid save discard cancel popup ?

Hey Kirti,

    public boolean onSavePrompt()
    {
        return true;
    }      

This Method U can put like a separate Method.

Like where the the UR constructor body is finished after that U can put.

------------------------------------------------------------------------------------

Press Kudo to say thank to developer.
Also Press the Accept as solution Button when u got the Solution.

Trusted Contributor
Posts: 204
Registered: ‎07-14-2010
My Device: 8100

Re: how to avoid save discard cancel popup ?

still i get the same issue when i exit my application using backspace ..

 

i ve used it after constructor class