Event of exit/close application trap on exit/return of the device button

I developed an application in Sib. I want to intercept the output/closing event of the request so that I can ask the user for the confirmation message.

It may happen that the user will click the back button on the BB device accidentally. If I don't want it of happen and will show the confirmation message.

There are a variety of ways that you can incorporate it, but I don't know of a hook that will let do it without changing your code.

The following suggestions can help you change your code.

(1) If your application has a home screen, i.e. that it all comes down, then override the close() method and replace with your dialogue.  If the user wants to get out, then call super.close ().

(2) If you have several places that emit the system.exit(), replace it with a call to your own method of "release manager", that shows the same dialog and emits only the system.exit() if confirmed.

Tags: BlackBerry Developers

Similar Questions

  • How to program the events for the back of the device button

    Hi all, I wanted to ask, is it possible to change the action of the back button on the blackberry device? I want to program my application after the user login, the back button does not return to the screen connection but moved into the background... Thank you

    's called it the ESC key. You can override onClose, for example, which is called when you try to close a form.

    or you can crush keyChar and check for Characters.ESCAPE

  • Key events of injection, but couldn't find what corresponds to the BB button?

    I'm trying to inject a key event to simulate the user after pressing the Menu button - IE the one with the logo of BB, which is triggered by pressing Insert on the Simulator. I tried to use Keypad.KEY_APPLICATION (0x15), Keypad.KEY_MIDDLE (0 x 13), Keypad.KEY_MENU (0 x 1002) and there is no result to inject these keys at all. All the other keys I try to inject seems to work very well. There is another constant, should I use?

    Using the JDE 4.3.0.1r version and the 8120 Simulator, if that makes a difference.

    Nevermind, I got it works using a KeyCodeEvent instead of a KeyEvent...

  • The application icon displays only not on the device


    Are you build the application that you are testing your device using Ant? If so, perhaps you have wrong path in the icon property.

    The value of your icon must be a relative path based on your destdir.

           
                
                
            
    
  • Application install but not found in the device

    I installed an application through the Application of Desktop Manager section using files .alx file. The blackberry that I use is Blackberry Curve 8520 (version 4.6.1.286). But it does not show in 'Downloads' or 'Applications', although in the "Setup", it is displayed in the application list. Can someone indicate what problem and how to do so that he can use?

    No, it is not an application. It is the application by using the features of the camera.

  • The video device is currently in use. Close any other program that is using the device and try again.

    After starting cold, without other programs started using Windows 7 Home Premiun for a place in the upgrade, I am unable to capture video DV camera DV over USB.  The same setup work properly on Vista Home Premium.  (MM6)

    By using the menu "Import device", the dialog box "Import pictures and videos" identifies the camera as "Digital vidéo caméras Video Edit".

    After the error message out of Movie Maker and reboot, then try again translated by "importing video has already begun."

    Microsoft Windows Media Encoder 9 Series do not seem to be available for Windows 7.

  • Application of background visible on a real device (all well in the Simulator)

    Hello

    I developed a small backgroundapplication, which shows a menu entry in the app phone "call via Asterisk. If I choose this option a defined number is called. Later, I want to add the number as dtmf tones.

    The application uses excactly as expected in the device Simulator 8310-JDE (included in the eclipse plugin) on JDE 4.5. with eclipse.

    But when I deploy the application (signed) to a real 8310 with firmeware v4.5.0.81, it appears an application icon on the desktop (homescreen) of blackberry and the menuentry in the phone app is missing. Why the application is not deployed as a background on the real dev app. ?

    The only difference between the Simulator and real device is the language chosen, but I don't think it's important.

    The application consists of files, as shown below.

    import net.rim.blackberry.api.menuitem.ApplicationMenuItemRepository;import net.rim.device.api.system.Application;
    
    public class Asterisk extends Application {   public static void main(String[] args)    {            // Create a new instance of the application            // and start it's event thread.            new Asterisk().enterEventDispatcher();    }
    
        public Asterisk()    {        //create a new instance of the menuitem       AsteriskMenuItem asterisMenuItem = new AsteriskMenuItem(40);
    
          //get the instance of the standard-menu an ad the new menuitem        ApplicationMenuItemRepository     .getInstance().addMenuItem        (ApplicationMenuItemRepository.MENUITEM_PHONE,asterisMenuItem);
    
        }}
    
    package com.schiffl.mobile.asteris;
    
    import net.rim.blackberry.api.invoke.Invoke;import net.rim.blackberry.api.invoke.PhoneArguments;import net.rim.blackberry.api.mail.Message;import net.rim.blackberry.api.menuitem.ApplicationMenuItem;import net.rim.blackberry.api.phone.Phone;import net.rim.blackberry.api.phone.PhoneCall;import net.rim.blackberry.api.phone.PhoneListener;import net.rim.device.api.system.ControlledAccessException;import net.rim.device.api.ui.Field;import net.rim.device.api.ui.UiApplication;
    
    public class AsteriskMenuItem  extends ApplicationMenuItem{     //number to be dialed via Asterisk        String servicenumber  = "1234567";
    
          //using the default constructors here.        AsteriskMenuItem(int order)       {         super(order);     }
    
           //methods we must implement       //Run is called when the menuItem is invoked      public Object run(Object context)     {             /*             * Normally the dialed number could be found in the context object             * because of a bug in the api which is solved in v.4.7 the context            * object is always null for MENUITEM_PHONE so it is necessary to          * use a workaround, here the number is extracted from the field with focus,           * which contains the dialed number           */            Field myField = UiApplication.getUiApplication().getActiveScreen().getFieldWithFocus();           String phoneNumber = myField.toString();
    
              //TODO Convert phoneNumber to dtmf-tones
    
              try           {             PhoneArguments call = new PhoneArguments(PhoneArguments.ARG_CALL,servicenumber);              Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, call);
    
    //                PhoneCall myCall = Phone.getActiveCall();//               myCall.sendDTMFTones(phoneNumber);            }         /*             * The ControlledAccessException is thrown             * if the system administrator restricts access to the phone application           * using application control.          */           catch (ControlledAccessException e)           {             //TODO some exceptionhandling             }
    
             //normally you can do something with the given context inside of the run-method           //because of a bug in the API the context is always null so, we don't use it...           return context;       }
    
           //toString should return the string we want to        //use as the lable of the menuItem        public String toString(){         return "Call via Asterisk";       }
    
    }
    

    The entry for the RRT signature was missing in my .csl file. I change it manually, I added

    '52525400 = RIM API execution' requested signatures, deployed and it works...

  • Continue to application play when the device goes into sleep mode

    Hey guys,.

    wondering if anyone knows how to maintain an active application when the unit goes into fashion watches?

    My application needs continue to work when the device goes into sleep mode if he went in that State by itself, or if the user put it to sleep.

    Yes I tried it on a physical device. It works, I promise you

    To clarify, here is what you will see when using KEEP_AWAKE:

    1 device shall not sleep when the application is currently active

    2. the device shall not sleep if the application is reduced, and you are in mode carousel

    3 device WILL sleep if the user switches to another application and full screen.

    In addition, another thing to know, if the unit is not assigned to the showcase mode, which is not by default, the audio stops when the user leaves your app. This is not related to sleep and is totally out of our control, but could be a good thing to add to your product details.

  • Catch the event close application?

    How can I catch the close application event? Can someone tell me the api to use? Thanks in advance.

    Create your own features to clean up when the application is going to come out.

    Do not call System.exit (0) directly in your application.

    Implement a method that makes all cleaning operations and calls System.exit (0) after all.

    And only call this method when you want to leave.

  • Cannot find a close application event.

    I have a script that runs on the document close event.  It seems that the document close event does not pull when the application is closed when a document is opened. I checked for an application event close to the listener Script log, but he wasn't an entry for it, and the document closing event was not present either.

    The script I'm writing a file in the same folder as the opened document that indicates that the file is in use. Then when the document is closed, the locking file is deleted.  It works except when you close the application.  There is no case of closed shooting paper, so the documents simply close and the application terminates without any triggering events.

    It is a way to know when the application closes?

    I found a possible work around that would be a huge pain.  The idea is about loading a custom external library that performs cleanup when it is automatically unloaded the closure of Photoshop.  It is the prototype of the function that would do the job:

    void ESTerminate (void);

    There is another work around this invloves a button that the user don't forget to click to close the application. It would be awkward and open to the user error.

    I want just the event document closed before the application closes. Thanks for your help!

    In Photoshop event handlers are called after the normal event with javascript scripts. It is not a close event because Photoshop is already closed is unable to call the Manager. Javascript runs with Photoshop as the host application and the event handler is destroyed at the close of Photoshop.

    You might want to look to write an extension with the CS - SDK. At the same time that they intend to offer both before and after the event handlers.

  • FP. Closing does not close application.

    When I use FP. Close in my main vi, which is the last step in my code, it stops the program, but does not close the front panel.  Although the program has stopped running, the front remains open.  I would avoid this because operators think it is still ongoing.

    -Thank you

    Well, I can not help with you feel, but you have to QUIT LABVIEW in an application.

    No matter HOW you exit you should not do before closing references, files, connections, etc.

    Once you have done all that, then it's time to LABVIEW to quit SMOKING if you are in an application.

  • NativeApplication.nativeApplication.exit (); problem in the iOS app

    This function called an iOS application to quit:

    function ExitApp(event:MouseEvent):void {}

    listenIO(urAt,0);

    trace ("NativeApplication Exit");

    NativeApplication.nativeApplication.exit ();

    }

    The function is triggered as the listenIO() does his thing and triggers trace(), but no exit(). The iOS app from closing by button menu material left, but when re-entering the app, it's stll where she was left and I did not have a function to return to a predefined State.

    Help to leave the popular app, thank you.

    A way to get around exit() doesn't work don't not on iOS may be set the following property in the iPhone of your XML application section:

    ...

    UIApplicationExitsOnSuspend

    ...

    That would force your application to quit to suspend (aka the user pressing the hardware button)

  • Event ID: 1000 - Faulting application vstudio.exe, version 13.0.0.0, failed module msvfw32.dll, version 5.1.2600.5512, fault 0x0000a81a address.

    Failing application vstudio.exe, version 13.0.0.0, failed module msvfw32.dll, version 5.1.2600.5512, address failure 0x0000a81a. After execution of the application for a day or two, the application closes.  The event log has been as above.  I ran "sfc/scannow" but he has no apparent effect.  Nothing in the log of events to indicate any repaired or replaced file.  How do I know if msvfw32.dll is bad, and if it is, how do I replace it.   If this is not bad, what else could be the cause?

    You run Microsoft® Windows® Update?  There are a couple of security updates for Visual Studio, DirectShow and Quartz which involve the msvfw32.dll and vstudio.exe.  Try and let the forum know if this helped.

  • How to close a pop-up window without closing the entire application?

    Greetings!

    I just want to ask for help with this case. Here, I have a screenshot of what I'm trying to accomplish:

    screenshot.jpg

    I used this code, but it turns out that it closes the whole application:

    import flash.system.fscommand;
    btn_exit.addEventListener (MouseEvent.CLICK, goExit);
    function goExit(evt:MouseEvent) {}
    fscommand ("QUIT");
    }

    should what code I use to accomplish my goal? Thanks in advance!

    Sincerely,

    Milo

    1. don't you implement event handing in CongratsMC?

    2. Yes, there is a conflict because congratulations to instance inside function is a quite different case: it is not seen outside the dropObject() method - therefore it can not be removed in the listener. So, you must do the following (read the comments in the case of top):

    function dropObject(e:MouseEvent):void {
         stage.removeEventListener(MouseEvent.MOUSE_UP, dropObject);
         stopDrag();
         var droppedOn:MovieClip;
         correctCounter.text = String(correct);
         if (currentlyDragged.dropTarget) {
              // loop through targets belonging to the currently dragged clip
              for each(var mc:MovieClip in currentlyDragged.dropTargets) {
                   if (currentlyDragged.hitTestObject(mc)) {
                        // get the target
                        droppedOn = mc;
                        currentlyDragged.removeEventListener(MouseEvent.MOUSE_DOWN, pickObject);
                        currentlyDragged.buttonMode = false;
                        currentlyDragged.x = droppedOn.x;
                        currentlyDragged.y = droppedOn.y;
                        correct++;
                        correctCounter.text = String(correct);
                        // stop loop - it is not necessary to continue
                        break;
                   }
              }
         }
         attempt++;
         attemptCounter.text = String(attempt);
         // return to the initial position if there is no hit
         if (!droppedOn) {
            currentlyDragged.x = startX;
            currentlyDragged.y = startY;
         }
         // DO NOT DECLARE THIS VARIABLE AGAIN - YOU ALREADY HAVE THE INSTANCE
         //var congrats:CongratsMC;
         if (correct == objects.length) {
              // DO NOT INSTANTIATE IT
              //congrats = new CongratsMC();
              // place i in the middle of the screen
              congrats.x = (stage.stageWidth - congrats.width) * .5;
              congrats.y = (stage.stageHeight - congrats.height) * .5;
              addChild(congrats);
         }
    }
    
  • How to close applications (e.g. camera), not only to return to the home screen?

    I would close an application, as soon as I'm done with it and not have to do so by accessing the home screen, then press during 2 seconds on the button home etc.

    Hi Quentin,.

    You can press on and press and hold the home button on the app and then slide up on the thumbnail of the app to close.

    Thank you
    Michelle

Maybe you are looking for