Thursday, February 7, 2013

[android-developers] Re: start AsyncTask from a background thread


I have a main background thread that's doing work that's needed
to be done relatively quickly...i.e. update the screen.

But there are times where I might have to do some additional work
(that's not that much of a priority - i was thinking of making that
an AsyncTask.


The notify/wait was a generic question - whether those can be used
and/or recommended for use under the android platform.




On Thursday, February 7, 2013 10:27:38 AM UTC-5, G. Blake Meike wrote:
You should say something about what you are trying to accomplish.  Starting an AsyncTask from a background thread is already a bit odd... waiting for it to complete (which you imply with your comments about .wait and .notify) is downright nuts.

Did you know that onPostExecute will be run on the thread on which the AsyncTask is created, provided that thread is a Looper?  If you just init your background thread as a Looper, you might be able to use the AsyncTask normally...

-blake

G. Blake Meike
Marakana

Programming Android 2ed is now in stores:


On Thursday, February 7, 2013 2:04:38 AM UTC-8, dashman wrote:
I'm in a worker thread and would like to start an AsynTask execution.

Preferably w/o starting a new thread. Help!


Also, is java threads as in (new Thread()) frowned upon in android.

I think i read somewhere .notify() .wait() etc. should not be used.

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment