Reputation: 38593
When using ThreadPoolExecutor can I use AsyncTask as the Runnable in my queue? Or does this defeat the purpose?
//A holder for various tasks
private final LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(5);
//Thread Pool Executor
private final ThreadPoolExecutor tpe = new ThreadPoolExecutor(3, 3, 10, TimeUnit.SECONDS, queue);
Upvotes: 3
Views: 3878
Reputation: 6250
Here is a nice approach if you need to manage your own task in a more custom way. Use queues and executors, the pass runnables or callables to them. http://ugiagonzalez.com/2012/07/02/theres-life-after-asynctasks-in-android/
Upvotes: 0