Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Regular Contributor
AndreyMM
Posts: 51
Registered: 05-27-2010
My Carrier: developer
Accepted Solution

Pop up from Background App.

Hi.

I use code from example:

http://supportforums.blackberry.com/t5/Java-Development/Create-a-Background-Application/ta-p/445226

but I can't run PopUp class from background class.

Now I use:

 

UiApplication.getUiApplication().invokeLater( new Runnable() {
    public void run(){
        UiApplication.getUiApplication().requestForeground();

        //Invoke PopUp calss

        UiApplication.getUiApplication().requestBackground();
    }
});


 

 

Please use plain text.
Developer
peter_strange
Posts: 14,614
Registered: 07-14-2008

Re: Pop up from Background App.

Please use plain text.
Regular Contributor
AndreyMM
Posts: 51
Registered: 05-27-2010
My Carrier: developer

Re: Pop up from Background App.

Thanks for the reply.

I try use this this code, but it's not work for my correctly.

Because if a use loop, the Dialog always invoke.

Now i use Timer, and it's work normally (with Popup). 

May by Timer is not the best option?

Please use plain text.
Developer
peter_strange
Posts: 14,614
Registered: 07-14-2008

Re: Pop up from Background App.

Sorry I don't realy understand your solution or even the problem that youare are trying to resolve.  Bt if it works, that can't be bad!

Please use plain text.
Developer
LSphone
Posts: 140
Registered: 02-08-2010
My Carrier: AT&T, Verizon

Re: Pop up from Background App.

Try this:

 

 

Application.getApplication().invokeLater(
  new Runnable() {
    public void run() {
      Dialog.alert("The toast is burning");
      }
    }
  );

 

 

Please use plain text.
Regular Contributor
AndreyMM
Posts: 51
Registered: 05-27-2010
My Carrier: developer

Re: Pop up from Background App.

[ Edited ]

This is my code:

public void run() 
{
while (!stopThread)
{
//In this plase I need Invoke PopUp

try
{
sleep(5000);
}
catch (Exception e)
{
//Exception handling would go here.
}
}
}

 if I use next code to run PupUp, Nothing happens.

 

 

UiApplication.getUiApplication().invokeLater( new Runnable() {
public void run(){
UiApplication.getUiApplication().requestForeground();

//Invoke PopUp calss

UiApplication.getUiApplication().requestBackground();
}
});

 if I use this code

 

synchronized(Application.getEventLock()){    UiEngine ui = Ui.getUiEngine();
Screen screen = new Dialog(Dialog.D_OK, "Look out!!!",
Dialog.OK, Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION), Manager.VERTICAL_SCROLL);
ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
}

 the Dialog box invoke every 5 seconds.

I need invoke PopUp screen only one times. And get responce from PopUp screen.

 

 

 

 

Please use plain text.
Developer
simon_hain
Posts: 10,780
Registered: 07-29-2008
My Carrier: O2 Germany

Re: Pop up from Background App.

you can get the return value using a DialogClosedListener.

save the state in a boolean flag and don't display new screens while one is displayed.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.

peter_strange wrote:
"This process should happen traumatically for you in both JDE and Eclipse."
Please use plain text.
Regular Contributor
AndreyMM
Posts: 51
Registered: 05-27-2010
My Carrier: developer

Re: Pop up from Background App.

LSphone, I try use your example. PopUp screen is not initialized.

Please use plain text.
Regular Contributor
AndreyMM
Posts: 51
Registered: 05-27-2010
My Carrier: developer

Re: Pop up from Background App.

Thanks guys.

Please use plain text.