Code example for ConditionVariable

Methods: block

     * Initializes the message looper so that the Camera object can  
     * receive the callback messages. 
    private void initializeMessageLooper() { 
        final ConditionVariable startDone = new ConditionVariable();
        Log.v(TAG, "start looper");
        new Thread() {
            public void run() { 
                // Set up a looper to be used by camera. 
                Log.v(TAG, "start loopRun");
                // Save the looper so that we can terminate this thread  
                // after we are done with it. 
                mLooper = Looper.myLooper();
                mCamera =;
                Looper.loop();  // Blocks forever until Looper.quit() is called.
                Log.v(TAG, "initializeMessageLooper: quit.");
        if (!startDone.block(WAIT_FOR_COMMAND_TO_COMPLETE)) {
            fail("initializeMessageLooper: start timeout");