06-09-2011 08:23 AM
Firstly, this forum has provided me with some great advice on getting my first PlayBook release onto App World so a big thanks to everybody at RIM and the community in general for the help.
I developed my application for AIR 2.5 using Flash Builder 4.5 and the BlackBerry PlayBook AIR APIs.
My application performs a long-running operation which, via a click event, calls a web service and requests some data. Currently, the application doesn't provide the user with any feedback and I'd like to change that!
I'm relatively new to the Flash Builder and wondered what was the best way to execute an operation like this and display a transparent "wait modal" perhaps with an activity indicator to the user while it's happening.
I have tried to implement this in several ways (using shapes. containers etc.) however the modal never displays when the onClick event is fired. I also looked into background processing but was warned against using this.
Any advice would be greatly appreciated. I'm relatively new to this development environment, so apologies if this is obvious!
Thanks in advance.
Solved! Go to Solution.
06-09-2011 08:44 AM
A request to a server is non-blocking, so you could allow the user to continue to work until the server job is complete which you will get the callback. In this case you could use the ActivityIndicator to let the user know that it is being processed (passive indication). If the job does take a long time and there is a way to poll the status of the job then a passive ProgressBar would show overall progress. Both of these can be placed in a corner of the screen so the user can see it, but can continue to work as needed.
However, if the job is a blocking request in which you dont want the user to do anything until the job is done, then you will want to be a modal about it (less desireable). You could place an AlertDialog window up with "Please wait..." in it with no buttons and then dismiss the dialog when the job is complete. You will need to keep a handle to the alert dialog so you can close it with the callback event. Since QNX AlertDialogs are server side and you cannot modify the look, you could build your own screen with a semi-transparent background and the ActivityIndicator or ProgressBar inside a frame to show progress/activity with modality. Connect the custom modal view to the stage. If you have an application bar, you may need to suspend that so the user cannot traverse to another page of your application.
If the job is truely long, I would add a "cancel" features in case it is just taking too long for them due to network issues.
Hope that helps.
06-09-2011 03:19 PM
Have a look at the SkinnablePopupContainer class. You can put whatever you like in it (e.g. a status label, a progress indicator, a cancel button etc). Then call the .open() method. One of the parameters allows you to make it modal.