解决方法
你检查过java.util.concurrent.Executors吗?你可以这样做:
final static ExecutorService tpe = Executors.newSingleThreadExecutor(); ... tpe.submit(new Runnable() { @Override public void run() { // your work } }):
它不是特定于Android的,它是jdk5的一部分.
来自doc:
Creates an Executor that uses a single worker thread operating off an unbounded queue. (Note however that if this single thread terminates due to a failure during execution prior to shutdown,a new one will take its place if needed to execute subsequent tasks.) Tasks are guaranteed to execute sequentially,and no more than one task will be active at any given time. Unlike the otherwise equivalent newFixedThreadPool(1) the returned executor is guaranteed not to be reconfigurable to use additional threads.