Android线程异步处理

private ExecutorService executorService;
private Future mFutureBitmapRunnable;

第一步:
this.executorService = Executors.newSingleThreadExecutor();
第二步:
on camera thread callback,do like below.
public void takePhoto(ImiDevice.ImiFrame frame) {
            if (mFutureBitmapRunnable != null && !mFutureBitmapRunnable.isDone()) {
                return;
            }
            ByteBuffer buf = frame.getData();
            buf.position(0);
            final byte[] rgb24 = new byte[buf.remaining()];
            buf.get(rgb24);
            final int width = frame.getWidth();
            final int height = frame.getHeight();
            mFutureBitmapRunnable = executorService.submit(new Runnable() {
                @Override
                public void run() {
                    //to do
                }
           });
}