[BB 5.0] Impossible to return to the foreground

I know similar problems have been discussed several times already, but looks like I'm still too noob to solve my problem. A problem is the following.

I am trying to create a simple GUI application. It starts automatically, adds a special menu item in the system menu and goes to the background hidden from the list of applications. Once the user clicks on the item menu (mentioned above), the application must show the user, do something and go back to the background. I used this article as a guide.

My code is (BTW, how I format the code here?):

SerializableAttribute public class BackTest extends UiApplication {}

private static final long APP_ID = 0xda989447901484c8L;

Private boolean isHidden = true;

Public Shared Sub main (String [] args) {}
RuntimeStore store = RuntimeStore.getRuntimeStore ();

BackTest PAP = null;

If (args == null | args.length == 0) {}
PAP = (BackTest) store.get (APP_ID);
If (PAP! = null) {}
theApp.setHidden (false);
theApp.requestForeground ();
}
} else {}
final BackTest app = PAP = new BackTest();
Store.Replace (APP_ID, PAP);

theApp.createMenuItem ();
theApp.setHidden (true);
theApp.invokeLater (new Runnable() {}
public void run() {}
app.moveToBackgroundOnStart ();
}
});
theApp.enterEventDispatcher ();
}
}

public BackTest() {}
pushScreen (new BackTestScreen());
}

private void moveToBackgroundOnStart() {}
ApplicationManager man = ApplicationManager.getApplicationManager ();
KeepGoing Boolean = true;
{while (keepGoing)}
If (man.inStartup ()) {}
try {}
Thread.Sleep (500);
} catch (Exception ex) {}
} else {}
this.requestBackground ();
}
}
}

protected boolean acceptsForeground() {}
return! this.isHidden ();
}

protected boolean isHidden() {}
Return isHidden;
}

protected void setHidden (boolean isHidden) {}
this.isHidden = isHidden;
}

private void createMenuItem() {}
placement of int = 0 x 350111;
Element ApplicationMenuItem = new ApplicationMenuItem (investment) {}
public String toString() {}
return to 'Just Do It';
}

public Object execute (object context) {}
try {}
ApplicationManager.getApplicationManager (.launch ("BackTest"));
} catch (ApplicationManagerException e) {}
e.printStackTrace ();
}
Returns a null value.
}
};

The ApplicationMenuItemRepository repo = ApplicationMenuItemRepository.getInstance ();
repo.addMenuItem (ApplicationMenuItemRepository.MENUITEM_SYSTEM, item);
}
}

My problem is that when I click on the menu item "Just Do It", the application does not appear. I see in the debugger, that requestForeground is called, but nothing happens after that. I tried different things, like using GlobalEventListener instead of launching the app again (which resembles the app in the background does not receive events) or by calling requestForeground directly in the menu item Manager, but nothing happens.

What I am doing wrong?

PS the JRE BB version is 5.0.

Interestingly, the code seems fine for me.  Sorry don't have time to test it myself ATM - maybe later.

There is one thing I would change:

theApp.invokeLater (new Runnable() {}
public void run() {}
app.moveToBackgroundOnStart ();
}
});

This in theory, runs your "pen" treatment, specifically sleep, on the thread of events.  You need not actually the bottom of the request to wait because if your application is enough to throw things on the event thread, then it can deal with the merits of the request.  Then you can just run the requestBackground

If you have other things you plan to wait at first, then in the executable you invokeLater, start a new Thread.  Sounds a bit complicated, I know.

I don't think that this causes you a problem in this circumstance.

I would like that you try to move your code to the main() in the run method ApplicationMenu.  There is no problem with this code getting your instance of the application and then by running requestForeground() on it.

If this does not help, you can do two things:

(1) create activate(), deactivate() methods in your Application, simply d put something out of System.out when these are run - call super too of course!  See the Application section to determine what these do.

(2) put a breakpoint in acceptsForeground() and see when it is in the order of things, it is called.  I have an idea it is actually called earlier than you expect.

Tags: BlackBerry Developers

Similar Questions

  • Impossible to return to the place where I ieft off after clicking the back button

    When I browse Smugmug photos, after you select the gallery that I want, when I'm done and I click the back button it brings back me initially galleries and not where I chose the last Gallery or photo. IE and chrome don't do that.

    Thank you for your question and I'm happy to help you. I understand that the back button does not work as expected in Firefox, all seeking to smugmug.

    At the same time as a work autour, if you right click on the back button, it will give the list all the pages that are visited.

  • Need help, returning at the request of private

    Hello

    My application uses a private to open a web page. When the web page opens, the user types in their login credentials, and then they are transferred to a new site that told them to close the BlackBerry browser and return to my request.

    Now, I'm trying to see if I can do the following:

    -Create a URI template customized for my application, so that the Web site can send to an address as "myapp: / /...". "and will open my application. I did research online and on the forums on this subject, and I don't think its possible. I searched a lot on JSR 211 content managers and MIME types. I have also studied the chapidemo demo in JDE samples.

    -Close the private. I know that I can't do this from within my application. I moved my application in the foreground successfully after my application filed an HTTP successfully, but the browser returns to the foreground when the Web site transmits to the new page (which tells the user to close the browser)

    -Somehow determine the URL of the current private. If I could do it, I could have my application in the foreground when I recognize the URL of the page that was passed to the.

    Unfortunately, I can't use a BrowserField because the site that I opened in the browser must support javascript and ajax... I tried this in the BrowserField, and it did not work.

    Does anyone have any advice or suggestions?

    Thank you!

    I was able to achieve bringing my application to the foreground once the browser forward towards a new page using JSR 211 and a type mime custom. (BrowserPlugin.java & LoaderApp.java JDE samples)

  • Impossible to go beyond the lock screen

    My wife and I are unable to go beyond the lock screen today. It's an iphone 6s and 7 times iphone running iOS 10. At the same time happened when we returned in the evening. When we enter the password, the screen freezes / hangs. Then, a minute or so later, it looks like to reboot the phone or reboot UI. then return to the lock screen. This is crazy. I feel like we're pirated! What is happening to someone else? Two of us do not have access to our phones!

    Have you tried a reboot?

    Reset?

    Restore?

  • My iPhone6 has convinced himself that he has a helmet connected - how can I convince otherwise and return to the normal setting?

    My iPhone6 has convinced himself that he has a helmet connected - how can I convince otherwise and return to the normal setting?  I tried turning it off and back on after awhile, but did not.

    Double check with a magnifying glass and a good lighting that nothing has been slain. Then, try insertion and withdrawal of your headphones a couple of times. If this does not work, it may be while the shooting went wrong. In this case, make an appointment at the Genius Bar at your local Apple store for the assessment.

  • I've updated my iPhone 6s version 9.3.4 and have no Service, how to return to the previous update?

    I've updated my iPhone 6s in the last (9.3.4) update and now have show no Service at the top. Yesterday, I had intermittent service and thought it was the carrier, but it's not.  I've been using Google Maps and it kept crashing and place would come no Service. Can someone help me to return to the previous update please?

    Before posting this question I've shot and turn it back on repeatedly, I followed all the steps that Apple has informed including turning airplane mode on/off, remove the SIM (my carrier replaced) and reset the network settings. I can't ring Apple for help and live about 3 hours in an Apple Store.  My phone was working perfectly before installing the update.

    You cannot revert to a previous version. Have you tried the latest suggestion here?

    If you cannot connect to a cellular network or cellular data - Apple Support

    If you still cannot connect to a cellular network and have confirmed with your carrier is not a problem with your account, or your network, try to restore your device.

  • The Messenger app will be not updated. Stuck on "Waiting."... "and the logo in grey. How can I fix this or return to the previous edition that worked?

    I received a prompt on my Ipod touch 5th generation yesterday, that there is a new update of the Messenger application. So I tried to update, however, the app is now stuck on the phase "Waiting."... "and the logo has been disabled. I still get notifications of new messages from the app, but I can't open. I tried to remove and then reinstall the application but the application did not and the app store think that I always opened it. How can I fix this or return to the previous edition that worked?

    Thank you in advance!

    Hello cfossum,

    Looks like you have problems with a third party on your iPod touch app, since the Messages belongs to iOS and you would receive separate not quickly update.

    The resources below will provide some troubleshooting steps for the problem you are having with the Messenger application.

    If an application you have installed unexpectedly closes, unresponsive, or does not open

    Take care.

  • I have an e-mail returned by the demon with the reason given as "over quota" what does that mean?

    I got an e-mail that is returned by the demon with the reason given as "over quota" that mean?

    Well, most ISPS and web-based e-mail providers have rules in place: some have attachments maximum file sizes, most have maximum rates for the number of recipients/how many emails per day. I had one that had a maximum bandwidth and would not deliver an email until tomorrow if I ended this day.

    So check the terms of your email provider.

  • [SOLVED] My Thunderbird in french and are suddenly transformed into English. How do I return to the french without any lose?

    My Thunderbird was in French interface and suddenly transformed in English while keeping a few things in French that is very troubling. In addition, he does not receive my mails on request but I must close and reopen to get my new emails and don't tells me no more with the blue envelope in the bar. How can I fix it and return to the French without losing my emails, files, and settings? My OS is Ubuntu LTS 14.04

    PROBLEM SOLVED

    Good. You can then mark the thread as "Solved" Please? Thank you.

  • return only the decimal value

    What function can I use to return only the decimal value of a formula

    (97 * 2.2) / 14 value returns 15.24

    I only want to use le.24

    Salvation is

    Use the formula - INT (formula)

    In the special case above:

    =(97*2.2)/14 - INT ((97*2.2)/14)

    You see two places to the right of the decimal separator in reason to be rounded off to the value real, in the shape of the cell to only show as two decimal places, either by setting the width of the cell close enough to force the rounding of the displayed value.

    Note that if the result is rounded (using the ROUND function) the actual value of the cell will be the rounded value. For the other two cases, the value displayed indicates only two decimal places, but the real value in the cell (and the additional calculations used by referring to this cell) is 0.242857142857144, which could lead to surprises in the results of the calculations downstream.

    Kind regards

    Barry

  • Is it possible to return to the synchronization of the former in Firefox, as new synchronization does not work.

    As new synchronization does not work for me, despite the setting it in total compliance with the Mozilla Web site and no one took the trouble to answer the previous post today, is it possible to return to the synchronization of the former?

    To the best of my knowledge, the synchronization of the former is no longer available.

    If you post some details on the problems you are having with the sync, we can try to solve your problem.

  • How to return to the position after recording Garageband?

    After recording something in Garage band, he returned at the beginning, I have to press return on the keyboard, how can I do it automatically go to the beginning or when I want to record from?

    If you turn on the Cycle region, GarageBand will always loop to the beginning of the sequence in a loop while recording.

    If not, see the list of shortcuts here: http://help.apple.com/garageband/mac/10.1/#/gbnd715f33a0

  • Read emails disappear from the Inbox when I return to the Inbox

    If 'Read' Emails are left in the "Inbox" and then I leave this folder, move it to another folder and return to the "Inbox" only "unread" e-mail is visible. All 'Read' previously in the "Inbox" emails have disappeared - I can't find them in any folder. Recently, I found the tab "Quick filter" - it is as if the tab "Unread" is locked on. Use Thunderbird Version 37.7.08.

    View (Alt - V) - son - all

  • I use the beta version, how can I return to the basis of Firefox?

    How can I return to the basis of Firefox instead of the beta?

    Backup of your profile and you will not lose your add-ons and bookmarks.

  • My ipad to randomly shut off applications and the internet and returns to the home page

    iPad 2 keeps returning to the home page of apps or

    sites Internet do - what I have to do? The software is

    iOS 9.3.2.

    Most likely, you have simply reached a point of overload with too many apps or too many browser tabs consume 100% of CPU. Try closing some of the apps when you want to open new ones.

Maybe you are looking for

  • LaserJet MFP M177fw Pro: M177fw can scan over the network

    Hello I would like to know if the printer permissions 'M177fw' to use the scanner to a pc connected via LAN. (based on analysis of the computer or send the scan from the printer to a network folder) I found this information on the manual. Thank you

  • my product key is no longer visible to windows 7 and I need!

    I have installed the preview of windows 8 and want to go back to my previous version which is windows 7 and it has been already installed I don't have a cd for it and the product key is not visible on the bottom of my laptop. Is the brand of my lapto

  • HP Deskjet 1512: List index out of bounds for Deskjet 1512

    Try to print lists of names of files and their size, developed by STG printed case, results in an error message of "List Index out of bounds".  The printer is a HP Deskjet 1512. Using Windows 7. All solutions?  Thanks in advance.

  • BlackBerry Smartphones BB pin

    Hi all I bought a used BB 9000 "BOLD", and I tried to connect the internet service, I found the code PIN is blocked and does not work... When I check the PIN to the back of the phone and the PIN in the BB Messenger, I found its different... I think t

  • Lightroom says expired trial even if I just paid for another year

    Can someone tell me why my Lightroom said trial exceeded despite the use for one year and who comes to renew my annual subscription, which shows as a pain in my account? When I try to run, he said he will work with limited functionality and then open