09-23-2009 09:25 AM
I would like to write an application that generally runs in background but in certain conditions will have to show a dialog. The dialog will be modal and on a separate thread.
My question is if it is possible to have such application that does not show a main screen but just dialogs when needed.
Is UiApplication the right approach? Can I have such applicatin with invisible main screen or no main screen at all but still beeing capable of showing dialogs?
Solved! Go to Solution.
09-23-2009 09:50 AM
Your Application extends UiApplication it always display MainScreen in background.
Otherwise,extends Application and use PopupScreen for transperant Display.
09-23-2009 10:10 AM
Thank you for your reply.
If I extend Application I will not have pushScreen methods. What technique could I use to push a PopupScreen from an Application?
I thought it is possible from UIApplication only.
09-23-2009 10:17 AM
First,If you are using UiApplication
pushScreen (new PopupTest()) ; --> like this.
class PopupTest extends PopupScreen
popupscreen will appear without transperant background.
Second.If you are using Application
use UIEngine for diplay popupscreen
It will give transperant popupscreen.
09-23-2009 10:25 AM
How can I use UIEngine from and Apllication?
UIEngine is an interface that is implemented by UIApplication.
If I use Application, the methods of UIEngine are not available to me.
My goal is to show pop-up screens from application that works in background. Is there any way I can make the MainScreen of an UIApplication permanently invisible?
09-23-2009 10:35 AM
if you give this your application turn to background.
now you want to invoke popupscreen
if you want transperant background
09-23-2009 11:10 AM
I'm sorry kumaresan, I don't think you are being very clear and in some cases, what you have said is not accurate.
You have as you originally suggested, two options:
Let us deal with the Application first. The problem with this is that there is, in theory, no way for an application to have any interaction with a screen. However you may wish to Alert the user from time to time. This KB article will tell you how to do that:
How To - Alert a BlackBerry smartphone user from a Background application
Article Number: DB-00407
Note that this will use GlobalScreens and there are many things that you can't do from Global Screens, for example, display menus.
If you wish to actually have a User Interface to an Application, you might also consider implementing the OptionsProvider Interface. You could use this to display screens used to set Options for your Application.
Now let us look at UiApplication.
UiApplication clearly has some interaction with the Screen, but what if you want to remain 'hidden'? Firstly you can remove the icon by making your application a System Module. However that will still leave the icon displayed when the user does a Task Switch. To ensure that the user can't see this, you override the acceptsForeground() method and return false.
Assuming you do that, then what happens when you want to display something? You need to do three things:
a) acceptsForeground must return true
b) push a Screen (normally not a popup screen, since your application will use the whole screen.
c) use UiApplication.getUiApplication.requestForeground() to get yourself into the foreground.
When your have finished with your Ui processing, you do the reverse.
It should, I believe, also be possible to display Global Screens without doing these steps, but I have never tried this.
Ok now to answer your question.
In your case, it seems like the best option for you is to extend Application, and use the the method outlined in the KB article to show your Dialog boxes.
Hope this makes sense and clears up the confusion.
09-23-2009 11:19 AM
09-23-2009 05:07 PM
Thank you for you answers. Everythong worked as you describe it.
Yes we do use DialogClosedListener to detect when the dialog is closed and get the results. We usually run our dialogs on separate threads.