12-11-2010 07:51 AM
Hi.
I use code from example:
http://supportforums.blackberry.com/t5/Java-Develo
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 ();
}
});
Solved! Go to Solution.
12-12-2010 10:14 PM
12-13-2010 05:34 PM
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?
12-13-2010 06:49 PM
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!
12-13-2010 09:23 PM
Try this:
Application.getApplication().invokeLater(
new Runnable() {
public void run() {
Dialog.alert("The toast is burning");
}
}
);
12-14-2010 09:51 AM - last edited on 12-14-2010 09:52 AM
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.
12-14-2010 09:59 AM
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.
12-14-2010 10:03 AM
LSphone, I try use your example. PopUp screen is not initialized.
12-21-2010 06:42 AM
Thanks guys.