03-28-2011 02:50 AM - edited 03-28-2011 03:06 AM
If anyone familiar with android developemnt, we know how good is AsyncTask utility for doing Thread operations in backend while showing the Progress bar on front end.
Does anyone attempted to create a BlackBerry version of AsyncTask and ready to share??
Thanks in advance.
03-28-2011 09:07 AM
All you need to do to work with the UI from a separate thread is to use the UiApplication.getUiApplication().invokeLater() method or synchronize on the UiApplication.getEventLock() and then you can update it. There are some details that you'll want to learn but that's the basic idea.
03-28-2011 10:22 AM
This isn't too hard basically you make a class that handles the thread. Progress bar which can be a custom component. As long as you have the threaded class give you info about what percent done it is, you can send that to the progress bar through a update type method. When the thread is done you can sent the response done as a callback method outside the thread that will close the progress bar.
So in other words
Call threaded class
Call progress bar (assuming it's a seperate screen), if not just enable updating of it.
Have Thread get updated percent complete
Sent that updated percent to progress bar which will repaint the screen
When finished have thread enter callback method
Stop updating progressbar/close screen
The reason I say use a seperate popup screen is you could push it modally and then you could block all other functions the user can do while your async task is running.
03-29-2011 12:27 AM
Sorry, my question might be unclear.
I did many applications which does the core IO operations on a seperate Thread while showing the Progress bar on UI thread.
When i see the Android AsyncTask, i feel more comfortable with the way it eases the Thread operations offering different methods for UI and Backend code and updating the Progress.
So, I just want to know whether anyone already ported the standard Android AsyncTask class into Blackberry environment or not?
08-08-2011 07:53 AM