Second AsyncTask not executing

android, android-asynctask, java, multithreading, sockets

Solution

I hated it when HONEY COMB changed the multiple AsyncTask execution from concurrent to sequential. So every time I execute an AsyncTask, I do something like this.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
    task.execute();
}

But the thread pool size is 5, if you add the sixth task, it will be added in a queue, and will not be executed until one of the 5 thread has finished.

Problem

I have 2 AsyncTask, one which is creating a socket connections and anotherone that is transmitting objects using those sockets. my code is this: ``` try { connectat = true; transmitter = new SocketTransmitter(); transmitter.execute(); connector = new socketConnector(); connector.execute(owner); this.open(); } catch (IOException e) { ``` However, the `AsyncTask` called `socketConnector` is never created or executed. I tried to change the order but then transmitter is not created or executed... Whats wrong with that?

Original source