What is wrong with this pattern which emulates AsyncTask functionality?:// on the UI threadfinal CountDownLatch latch = new CountDownLatch(1);onPreexecuteWrapper();new Thread(new Runnable() {        doInBackgroundWrapper();        latch.countDown();    }}).start();new Thread(new Runnable() {    @Override    public void run() {        try {                latch.await();        } catch (InterruptedException e) {            Logger.error(TAG, Not good.);        }    context.runOnUiThread(new Runnable() {        @Override        public void run() {            onPostExecuteWrapper();        }    });}}).start();Here's what I think is wrong:Two threads -> more resources (I didn't compare actually, just guessing).No progress update functionality.Appears to be stinky.
AsyncTask alternative with Runnable and CountdownLatch
java;multithreading;android
First thing that is wrong is that you are reinventing a wheel.Second why not ditch the CountDownLatch and do context.runOnUiThread directly in the first runnable instead?// on the UI threadonPreexecuteWrapper();new Thread(new Runnable() {    @Override    public void run() {        doInBackgroundWrapper();        context.runOnUiThread(new Runnable() {            @Override            public void run() {                onPostExecuteWrapper();            }        });    }}).start();Last thing is that it's better to use an Executor and ThreadPool than to spawn new threads.