AsyncTask and message handling

Put your problem here if it does not fit any of the other categories.

AsyncTask and message handling

Postby theblang » Mon Jun 07, 2010 8:18 pm

I currently have an upload task that I want to happen in the background. The task can be started from lets say Activity X. Now, if the activity is started I would like for the user to be able to go to Activity Y or Activity Z and still have a message dialog pop up when the task started in Activity X is done. Any tips on where to look in order to achieve this (if it can be done). Currently my upload AsyncTask works fine IF I stay on Activity X. Will I need to make use of a service rather than an AsyncTask in order to achieve this communication between activities?
theblang
Junior Developer
Junior Developer
 
Posts: 15
Joined: Tue May 18, 2010 9:37 pm

Top

Re: AsyncTask and message handling

Postby padde » Mon Jun 07, 2010 10:44 pm

Jep.. sounds like you should use a service here. Let the asynctask run in the service and bind the activities to the service and send a message back to them if the asynctask is done... or (more common) send a notification when
the asynctask is done.
padde
Master Developer
Master Developer
 
Posts: 443
Joined: Wed Apr 08, 2009 4:52 pm

Re: AsyncTask and message handling

Postby theblang » Tue Jun 08, 2010 12:02 am

Awesome. Thanks a lot padde!
theblang
Junior Developer
Junior Developer
 
Posts: 15
Joined: Tue May 18, 2010 9:37 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: MSNbot Media and 18 guests