Pushing the FolderListener screen

Hello

I'm new to the blackberry development. We create an application user interface using blackberry JDE 4.5.

We have a FolderListener in our application that checks all new e-mail messages.

Basically, our application consist of a login screen where the user enters his credentials. This connection references will be sent by e-mail on the server where it will be checked.

Until the connection information are checked by the server, the user of the device will be able to access the application.

The server will return an email of acknowledgement to the device. This e-mail to information if the connection succeeded or failed.

If the connection has failed to display an error message to the user on the login screen.

If the connection is successful it will happen and users will continue to access the application that he was.

public class MyApplication extends UiApplication implements FolderListener,
        SystemListener {
    Vector messageVector = new Vector(1, 1);

    Store defaultStore = Session.getDefaultInstance().getStore();

    public void messagesAdded(FolderEvent e) {
        Message orginalMessage = e.getMessage();
        Folder messageFolder = orginalMessage.getFolder();
        Store s = messageFolder.getStore();

        if (e.getMessage().isInbound() == true) {

            String msg = "Got Message";

            try {

                // Get the message subject
                String subject_full = orginalMessage.getSubject();
                String subject = "";

                char c = "|";

                try {

                    // subject_full = ACK|FAIL|LGN
                    Vector v = Util.split(subject_full, c);
                    subject = (String) v.elementAt(0);
                    subject = subject.toUpperCase();

                    if (subject.indexOf("ACK") != -1) {
                        try {
                            Vector v1 = Util.split(subject_full, c);
                            String acknowledgementType = (String) v1
                                    .elementAt(1);
                            if (Constants.ACK_FAIL.equals(acknowledgementType)) {
                                LoginScreen screen = new LoginScreen();
                                screen.errorMsg .setText("Login was unsuccessfull."));

                                synchronized (getEventLock()) {
                                    pushScreen(screen);
                                }

                            } else if (Constants.ACK_OK
                                    .equals(acknowledgementType)) {

                                }
                            }
                        }
                    }
                }
            }

        }

    }
}

This code runs as part of the message processor, you really need to run in your Application.  So if your folder listener think that the email is a response, then it must pass this information on to your application for processing.  You can do this easily with world events. and using a Global event will greatly simplify this treatment.  Change this code to just fire one listener event, listening the event in your Application, and you will show a screen in your application.

The 'trick' one, is that your application should work to make it work.

Here's the documentation pertaining to global events you need.

What is - world events and global event listeners
Article number: DB-00145
http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800620/What_Is...

Tags: BlackBerry Developers

Similar Questions

  • How to push the second screen?

    Hello

    I am writing an application in which I'm trying to push a second display to a custom in the first menu item. The first screen is pushed successfully and the custom menu items are filled with a bluetoothserialportlistener. Once I click on a special menu item, I want to launch the second screen. I used a dialog.alert to verify that the the menuitem run() method works, but the second screen is not displayed.

    Any suggestions are greatly appreciated!

    The first screen is created by hand (String [] args)

    MatMain app = new MatMain();

    app.enterEventDispatcher ();

    private MatMain() {}

    pushScreen (new WelcomeScreen());

    }

    I tried to call the second screen as follows:

    synchronized (UiApplication.getEventLock ()) {

    getUiEngine () .pushScreen (new MatOnline (_info));

    }

    I also tried:

    UiApplication.getUiApplication () .pushScreen (new MatOnline (_info));

    Thanks again!

    Hello

    I think you're trying in a very complex way.

    Your architecture using complex and ignoring the bluetooth codes related, I can see your second screen with a minor modification.

    In your DeviceMenuItem class.

    replaced

    MatMain.getUiApplication () .pushScreen (new MatOnline (_info));

    with

    UiApplication.getUiApplication () .pushScreen (new MatOnline (_info));

    And in your class MatOnline:

    replaced

    HorizontalFieldManager _fieldManagerOnline;
    with

    HorizontalFieldManager _fieldManagerOnline = new HorizontalFieldManager();

    Concerning

    Bika

  • Push the second screen

    I have classes: CustomMain and Menu.

    In my CustomMain I have a listener for a button when I press this button that my class of menu appears. but the screen is blank...

    CustomMain:

    My CustomMain extends UiApplication as

    FieldChangeListener customListener = new FieldChangeListener() {
                public void fieldChanged(Field field, int context) {
               UiApplication.getUiApplication().pushScreen(new Menu());
    
               }
    

    Menu

    My menu classes exends as screen

           MainScreen mainScreen = new MainScreen();
    
            ButtonField test = new ButtonFieldja);
    
            mainScreen.add(test);
            UiApplication.getUiApplication().pushScreen(mainScreen)
    

    The menu of your class is:

    class Menu extends MainScreen();

    Do in the constructor:

    Super();

    ButtonField test = new ButtonField ("jan"); d.Add (test);

    No need to use pushScreen in the constructor of the class Menu

  • Push the screen automatically

    Hello

    I have two simple screens. What I want to do is to push the second screen automatically after a certain period of time. Any thoughts on how to achieve this?

    Thank you

    Diego

    It takes a different approach to the recommendation of mreed, but you can go.

  • Print screen does not appear when I press the print screen key.

    Original title: screen printing

    When I push the print screen button nothing happens, when I go to my doc and change the block is not highlighted

    On Tuesday, February 7, 2012 13:57:37 + 0000, cherylon wrote:

    When I push the print screen button nothing happens, when I go to my doc and change the block is not highlighted

    In the days of DOS, the print screen button to print the screen. But
    in all versions of Windows, it works differently and the name of
    the key is now an anachronism. The key is not to print the screen.
    PrtScrn captures the entire screen and Alt-PrtScrn captures activate
    window.

    Either a capture of the image in the Windows Clipboard. Once it is in
    the Clipboard, you can paste (Ctrl + V) into any application that
    supports graphics (Windows Paint, other graphics software, even your)
    favorite text processing). You can change or add to the image you
    like, then print it out.

    This ability to manipulate the image in a program before printing
    is an improvement on the original method of printing the whole back.
    But if you like that old return facility, there are several
    freeware/shareware programs from third parties which can do, such as
    PrintKey2000 to
    http://www.Sharewarejunkies.com/00zwd2/printkey2000.htm

    Ken Blake, Microsoft MVP (Windows desktop experience) since 2003
    Please reply to the newsgroup

  • Unable to get the 'splash' screen to work with sample

    Using the RIM as a model example, I have this:

    {public Dib (boolean ribbonClicked)

    {if (ribbonClicked)}
    Launch the application
    this.pushScreen (new SplashScreen (UiApplication.getUiApplication (), new GameScreen()));
    this.pushScreen (new GameScreen());
    } else {}

    and this:

    public class SplashScreen extends full screen {}
    Private fields
    Following private FullScreen;
    application of UiApplication private;
    private Minu = new Timer();
      
    private final static Bitmap _bitmap is Bitmap.getBitmapResource ("berrysoft_logo.png");.
      
    Public SplashScreen (UiApplication ui, following fullscreen) {}
    Super(Field.USE_ALL_HEIGHT |) Field.FIELD_LEFT);
           
    This.application = ui;
    This.Next = next;

    This.Add (new BitmapField (_bitmap));
           
    SplashScreenListener listener = new SplashScreenListener (this);
    this.addKeyListener (listener);

    Timer.Schedule (new CountDown(), 5000);

    application.pushScreen (this);
    }

    but when I click on the application icon on the Ribbon, instead of work (as it does if I just press on GameScreen, it 'freezes' (a few seconds), then does nothing (IE never left the band).)

    What's wrong?

    The SplashScreen sample itself grows in the stack to display within its constructor.  You do not need to push, simply create an instance of it.  Pushing it, you try to push the same screen in the battery twice, which is not allowed.

  • How to push a Global screen on top of all the screen?

    Hi guys,.

    I'm working on an application of cascade.

    In the application from Server looging page and I have displayed in WebView Cascade using qml.

    Once the user is connected, I need start a clock and after 15 min, I need to display a screen on the top of any screen. Once the user submit on this newly pushed screen, I need to return to the previous screen where the user was.

    Please give me an idea how to do it.

    Hello

    This link below helped me to solve my problem.

    http://supportforums.BlackBerry.com/T5/Cascades-development/push-a-QML-page-using-a-C-defined-Naviga...

  • by pushing the overall push message on the screen

    Hello

    I use push notification to display push messages, it works very well.

    But my problem is that my popup message arrives while I open the app, but I want it appears on the screen without having to open the application, and after clicking ok it must open the app.

    any body can help me.

    Thank you.

    Hello

    I use following code to run the ap on the click event of globle push message popup. but I'm not able to run any budy find what wrong with this code.

    UI UiEngine is Ui.getUiEngine ();.
    Screen = new (Dialog.D_OK, SplashScreen_Land.dealTitle1 dialog box,
    Dialog.OK, Bitmap.getPredefinedBitmap (Bitmap.EXCLAMATION), Manager.VERTICAL_SCROLL);
    final dialogue screen = new (Dialog.D_YES_NO, SplashScreen_Land.dealTitle1 dialog box,
    Dialog.OK, Bitmap.getPredefinedBitmap (Bitmap.EXCLAMATION), Manager.VERTICAL_SCROLL);
    screen.setDialogClosedListener (new DialogClosedListener()
    {

    ' Public Sub dialogClosed (final dialog box, final choice dialog box int)
    {
    If (screen.getSelectedValue () is Dialog.YES)
    {
    Boolean isAppOpen = false;
                                
    int modHandle = CodeModuleManager.getModuleHandle ("Sasta");

    ApplicationDescriptor apDes [] = CodeModuleManager.getApplicationDescriptors (modHandle);
                                
    If (apDes! = null)
    {
    Dialog.Alert ("Hi not null");
    ApplicationDescriptor [foreground_apps] is ApplicationManager.getApplicationManager () .getVisibleApplications ();.
                                
    If (foreground_apps! = null)
    {
    for (int i = 0; i)<>
    {
    If (foreground_apps [i]. Equals(apDes[0]))
    {
                                
    isAppOpen = true;
                                
    ID_processus int is ApplicationManager.getApplicationManager (.getProcessId(apDes[0]));.
    int fgprocess_id is ApplicationManager.getApplicationManager () .getForegroundProcessId ();.
                                                                                                                   
    if(Process_ID == fgprocess_id)
    {/ / Dialog.alert ("hiforground");}
    This means that your application has opened and it is in the foreground
    UiApplication.getUiApplication () .pushScreen (new SplashScreen_Land());
                                
    }
    on the other
    {//Dialog.alert ("Hi, background");
    This means that your application is open, but it's the bottom
    Ask now in the foreground
    AppManager ApplicationManager = ApplicationManager.getApplicationManager ();
    appManager.requestForeground (process_id);
                                                                      
    UiApplication.getUiApplication () .pushScreen (new SplashScreen_Land());
    }
                                
    }
                                
    }
                                
    }
                                
    if(!isAppOpen)
    {
                                
    This means that the app is not open, you need to open the application.
    try {//Dialog.alert ("Hi new open");
    ApplicationManager.getApplicationManager (.runApplication(apDes[0],true));
    UiApplication.getUiApplication () .pushScreen (new SplashScreen_Land());
    } catch (ApplicationManagerException e) {}
    Generative TODO catch block
    e.printStackTrace ();
    }
                                                                                                           
    }
                                
                                
                                
    }
    UiApplication.getUiApplication () .pushScreen (new SplashScreen_Land());
    Alert.startVibrate (2000);
    do something that takes a long time
    }
    on the other
    {
    Screen.Close ();
    }

    }
    });
                
                
              
    ui.pushGlobalScreen (screen, 1, UiEngine.GLOBAL_MODAL);
    PersistentStorage_Sasta_High.setTotalMsgCountDec ();
    PushController_Sasta_High.updateIndicator (PersistentStorage_Sasta_High.getTotalMsgCount ());

  • Push the pop-up screen at the top of the lock screen

    Hi, is it possible to grow a popup with some editfields screen, while the device is locked?

    I am currently using:

    Ui.getUiEngine().pushGlobalScreen(customPopUpScreen, 100, UiEngine.GLOBAL_QUEUE);
    UiApplication.getApplication().requestBackground();
    

    but it is not display the dialog box when the screen is locked. It seems possible, considering that the native app alarm shows the dialog box while the device is locked.

    Help please!

    I am sure that you are referring to http://supportforums.blackberry.com/t5/Java-Development/pushGlobalScreen-restrictions/m-p/19550/high...

    In this discussion, they came to the conclusion that nothing can get pushed on top of the screen to unlock except the native alarm alert dialog box. I guess I can push the alert dialog but I need user interaction while the device is locked, so I guess that answered my question

    Thanks Peter!

  • pushed single screen several times on display battery but can not go back to the previous screen again by clicking on "back" to come to the first screen button

    Hi all

    There is a screen with meter as label, datefield and objectchoicefield in the menu drop down and add and go button, this screen is pushed repeatedly on display battery until the meter is new. But when I try to go back to the previous screen, there is problem normally by substituting the onClose() method you can pop current screen and can get the previous screen, using getActiveScreen() and then push it again if you do not override os onClose() automatically do it for you.

    But in above case when I click on the button "back" or screen previous override onclose and push, I see my first screen I wanted my current screen with the counter that is if active screen is having against label like new if I press the "back" button, it should display screen with the meter only eight and so on.

    Can someone please help me solve this problem.

    Thanks Peter for you answer, actually used function for pushscreen on stach display that was written by someone else, when I looked carefully there condtion as below,

    if (activeScreen != null) {
     Class screenClass =activeScreen.getClass();
        if (screen.getClass().equals(screenClass)) {
                        UiApplication.getUiApplication().popScreen(activeScreen);
        }
    }
    

    It's actually the previous screen of poping before push the screen from the class were same, just commented and everything works, even if you do not override onClose and press return, it will automatically displays the previous screen.

  • Not pushing the screens and camera 8900

    Im having two problems in my code...

    the first don't push a screen in a menu. What of weird, is that I have two other options on the menu that will push the screens.

    Here is the code:

    private _server MenuItem = new MenuItem ("Server", 110,
    30 k
    {
    public void run()
    {
    UiApplication.getUiApplication () .pushScreen (new Server());
                    
    }
    };

    the second problem is very similar... but it's the camera of 8900 dreaded

    SerializableAttribute public class CameraScreen extends form {}
        
    private photMan PhotoManager = new PhotoManager();
        
    private VideoControl _vidcon;
    Player;
    _videofield of private sector;
        
    private String image_Type = "encoding = jpeg & width = 2048 & height = 1536 & quality = very good;
    private byte [] image_Array;

    Phto of photos;
     
    CameraScreen _camScreen;
        
    VerticalFieldManager _vfm = new VerticalFieldManager (VerticalFieldManager.USE_ALL_HEIGHT |) VerticalFieldManager.USE_ALL_WIDTH)
    {public void paint (Graphics graphics)
    {
    graphics.setBackgroundColor (0x00BDC29A); / / Gray special
    Graphics.Clear;
    Super.Paint (Graphics);
    }};
        
        
    Private UiApplication UiApp;
        
    CameraScreen (Photos pht) {}

    Games of skill to the singleton
    photMan = PhotoManager.getInstance ();

    UiApp = UiApplication.getUiApplication ();
    Photo gets assigned locally and assigns him photomanager
    This.PHTO = pht;
    photMan.setPhoto (phto);
    make easy pop screen
    _camScreen = this;
                
    Add the player to the screen to be used
    _vfm. Add (_videofield);
            
        
    This starts the camara media feature
            
            
    CreateCamera();
    try {}
    Player.Start ();
    } catch (MediaException e) {}
    Dialog.Alert ("Err:" + e);
    }
            
            
    Dialog.Alert ("Press Enter to take photo");
    }

    It takes the photo and shows a preview
        
    Public Sub takePicture()
    {
    Dialog.Alert ("what happens");
    try {}
    photMan.setImageData (_vidcon.getSnapshot (image_Type));
    Dialog.Alert ("inside the test');
    } catch (MediaException e) {};
                               
               
    Dialog.Alert ("just before the next screen push");
    UiApp.pushScreen (new CamPreviewScreen (_camScreen));
            
        
    }

    Public Sub CreateCamera()
    {
    try {}
    Reader = Manager.createPlayer ("capture://video");
    Player.Realize ();
                
    _vidcon = (VideoControl) player.getControl ("alarm");
                
    If (_vidcon! = null)
    {
    _videofield = _vidcon.initDisplayMode (Field) (VideoControl.USE_GUI_PRIMITIVE, 'net.rim.device.api.ui.Field');
    _vidcon.setDisplayFullScreen (true);
    _vidcon.setVisible (true);
    }
    Add (_videofield);
                
                
                
            
    } catch (Exception e) {}
                    
    Dialog.Alert("E:"+e);
    }
    }

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

    I use a headset button to access the feature, and I know that the function is called... This works also in the Simulator, but not in the device...

    Any help would be appreciated...

    This is random... but I solved the problem of 8900. Also, it happened to me when I was with the InvokeCamera App. The solution to get the CameraDemo to work is to make sure you build the program is less than or equal to the JDE version JDE on the phone

    Example:

    Compile the JDE 4.6.0 (computer)

    Work on 4.6.1 (phone)

    Compile the JDE 5.0.0 (computer)

    Does not work on 4.6.1 (phone)

    Just make sure that you compile the .cod with the correct version of the SDK and you wil have no problem. Hope this can help some people.

    Note: You will still need to clear the screen of all fields except for the videoField to do, this includes the setTitle()...

  • How to open push a new screen and pop the existing one?

    Hello

    Let's say I'm on A screen and I press a button to load the screen B. What is the best way to load screen B and remove the screen has?

    In other words, there are many cases in which I have to open, or push, a new screen and I want to close or pop, the pre-existing one. I tried to do this in two ways, but I keep getting errors.

    Thank you!

    Hello

    have you tried with

    UiApplication.getUiApplication () .popScreen (activeScreen);

    UiApplication.getUiApplication () .pushScreen (nextscreen);

    Please use the option "search" in this forum. you will get a lot a lot of samples on this topic.

  • Problem with push the screen of an application

    Hello

    I developed an application with another point of entry. I have the main GUI application and an application that listens for push notifications. The background listener auto starts when the unit is turned on and tuned to push. When it receives the push message, it displays a popupscreen with the options 'launch' and 'Cancel '. By pressing 'start' should open the graphical application by pressing the main screen of the application. However, I get "ClassCastException" and I have no idea why.

    I looked around and the process is similar to what I did, but somehow, it does not work for me. Can someone explain or show me how to push a background application screen?

    See you soon!

    Welcome to the forums!

    I guess as you push a display context global [and maybe modal] 'launch' and 'Cancel' buttons. When you press 'start', then, you should not just push a screen - you should actually run the main application!

    To do this, you must create an application with the appropriate settings and say ApplicationManager descriptor to run it. Take a look at the documentation ApplicationManager, especially the section "running an application with different arguments. Make sure the arguments are according to the needs of your main application, not the bottom one.

    Only one problem: what happens if your application is already running but reduced? Don't worry - you try to run the same application with the same arguments will activate one already running!

    Good luck!

  • Push the screen Modal issues

    Hey thanks to pass along,

    I was sitting on my bed, when it hit me, is it possible to push a screen outside of the application.

    So I discovered on the global screens and pushing them. However. Suppose I want to dismiss the screen right now, but I wish instead of opening another application and return to it later. Is it possible to pushGlobalScreen, or I should do otherwise. If other, then suggestions?

    None

  • I can't get the screenshot of Windows to function at work. I try to push the Windows and print screen key, but it does nothing.

    When I used Windows 8 Developer Preview screenshot function worked fine. The screen flashed and saved my screenshots. I pushed the Windows and print screen key. Now that I've updated, I can no longer do this. I am of ideas what is wrong. Any help would be great!

    P.S. - This is the account I want to use! So I thought to it. In the case of my laptop (HP HDX 16 t) I have to press FN + WINDOWS KEY + print SCREEN. If anyone has the same problem, they should try it.

Maybe you are looking for

  • Disabling hardware acceleration also live up to anti-aliasing of fonts

    As in the title. First screenshot shows what happens with hardware acceleration enabled, which seems better, second screenshot shows how it looks an alias with disabled acceleration with the race missing in some places on the very light fonts. Howeve

  • How do you get a man to talk to him?

    How can I get a human being to talk to him?

  • Try to restore Satellite U400 with external ODD

    Hi, I'm fighting with my laptop trying to restore it to factory settings, my cd player died some time ago and I have been using an external. I tried to restart using the recovery disks in the external drive, it starts the process and wants the recove

  • OfficeJet Pro 8600 Plus: problem of scanning the computer

    I have a HP Officejet Pro 8600. It is configured for a wireless connection.  All the features work, i.e. copying, printing out of internet/office, Fax, with the exception of scanning.  The printer is displayed the "OS is not taken in charge for this

  • Device USB not recognized (malfunction)

    I went on my external hard drive and an error message came - USB not recognized - device due to a malfunction. I tried switching off all voltage and turn support but still the same voltage. Then I went to print something and the same message came. Ho