Blackberry - How to transfer data from background to main ui application

Iam using push notification to show notification. Its working fine by Alternate Entry point. Background application will listen for notifications. When I click on a notification, I want to open a specific page on my UI application. How is it done? I tried using the following code, but it will alway load the Ui from the starting page. How can I load a specific page if the app is already running. Else load the UI from the begining page. Also I want to pass some values from the Background app to the UI Application.

try {
     ApplicationDescriptor[] appDescriptors = 
     ApplicationDescriptor appDescriptor = 
         new ApplicationDescriptor(appDescriptors[0], new String[] {"MYAPP"});
} catch (ApplicationManagerException e) {


You are already transferring data from the background to the main UI Application (the string "MYAPP").

Your application (the one listed in your previous question) starts up, and checks the arguments passed to it, and then determines whether to run in the background, or as a normal UI Application.

You can just add more arguments. In the code above, change it to something like this:

ApplicationDescriptor appDescriptor = 
     new ApplicationDescriptor(appDescriptors[0], 
                               new String[] { "MYAPP", "4", "FirstScreen" });

Then, in your UiApplication subclass (e.g. in, you can change it to

public static void main(String[] args)
    Application theApp = null;

    switch (args.length) {
    case 2:
        // initial screen and number of notifications provided
        theApp = new App(args[2]);
    case 1: 
        // just the number of notifications was provided, not an initial screen name
        theApp = new App();
    case 0:
        // no arguments .. launch the background application
        BackgroundApplication app = new BackgroundApplication();
        theApp = app;


... where I've added the setNumberOfNotificationsReceived() method and the App(String) constructor in your App class. Those are just examples. Make them whatever you want.

public App()
    // Push a screen onto the UI stack for rendering.
    pushScreen(new DefaultScreen());

public App(String screenName) {
    if (screenName.equalsIgnoreCase("FirstScreen")) {
        pushScreen(new FirstScreen());
    } else {
        pushScreen(new DefaultScreen());

Need Your Help

how to extract only specific strings in VBA

excel vba excel-vba

I have already asked a question at Extract strings from one text cell in VBA. First of all, I apologize for raising a challenging question that may take more of your time.