I have a helper class that contains definition of an AsyncTask(inner
class). Other classes instantiate this class and call one of its
method which in turn instantiates, the AsyncTask and starts execution.
class TaskManager{
private class SomeTask extends AsyncTask<>{}
public void performTask(){
new SomeTask().execute();
}
}
//usage: new TaskManager().performTask();
I schedule Alarms which when triggered start a Service. When the
service starts it creates a Runnable and enqueues it in the work
queue. From this Runnable, I want to instantiate my helper class and
start execution of the AsynTask.
The problem is AsyncTask needs to be instantiated from main UI thread
I am getting errors as soon as the spawned thread calls the method of
the helper class. The exception is that AsyncTask cannot be called
from a thread that hasnt called Looper.prepare().
How do I avoid this?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en