tags:

views:

247

answers:

2

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);
+1  A: 

An AsyncTask is not a Runnable so you can't really use that.

Soulreaper
A: 

Like Soulreaper says, an AsyncTask is not a Runnable so you can't use it with a ThreadPoolExecutor. Note that AsyncTask execution is done using a thread pool automatically.

mbaird