3

I am writing a blackberry application and pushing screens one after another(three in series)

Screen1 displays Screen2 and Screen2 displays Screen3

When i press "Back Key" on my Blackberry Device i.e., bold 9700, its prompts a dialog box with Question mark image and buttons "Save" "Discard" "Cancel".

Why does this dialog appears? How can i avoid this dialog?

Please Help Thanks SIA

SIA
  • 773
  • 3
  • 11
  • 22
  • possible duplicate of [Blackberry - Disable Save option in BasicEditField ?](http://stackoverflow.com/questions/2461403/blackberry-disable-save-option-in-basiceditfield) – chakrit Jul 28 '11 at 18:10
  • 1
    This is a [duplicate](http://stackoverflow.com/questions/2461403/blackberry-disable-save-option-in-basiceditfield) – Michael B. Mar 28 '10 at 16:05
  • 1
    It might be a duplicate, but it's clearer and more useful than the one it's a duplicate of... – Ryan Shripat Oct 04 '11 at 01:47

3 Answers3

1

you can avoid this type of dialog by overriding onClose method for that screen :

public boolean onClose() 
{

  this.close();
  return true;
}
Dhiral Pandya
  • 10,311
  • 4
  • 47
  • 47
1

There are two ways of doing this:

  1. Override the isDirty() method of your Screen (via: Blackberry - Disable Save option in BasicEditField?):

    public boolean isDirty() { return false; }

  2. You can also override the onSavePrompt() method of your Screen (also via: Blackberry - Disable Save option in BasicEditField?):

    protected boolean onSavePrompt() { return true; }

Community
  • 1
  • 1
Ryan Shripat
  • 5,574
  • 6
  • 49
  • 77
0

Simply Write this code in your specified class:

 protected boolean onSavePrompt() 
   {
       return true;
   }  

It will disable the Save Prompt Dialog Box.

Ahmad Shahwaiz
  • 1,432
  • 1
  • 17
  • 35