Code example for Looper

Methods: getThreadquit

0
     
    /* 
     * Terminates the message looper thread. 
     */ 
    private void terminateMessageLooper() throws Exception { 
        mLooper.quit();
        // Looper.quit() is asynchronous. The looper may still has some 
        // preview callbacks in the queue after quit is called. The preview 
        // callback still uses the camera object (setHasPreviewCallback). 
        // After camera is released, RuntimeException will be thrown from 
        // the method. So we need to join the looper thread here. 
        mLooper.getThread().join();
        mCamera.release();
    } 
     
    //Implement the previewCallback 
    private final class RawPreviewCallback implements PreviewCallback { 
        public void onPreviewFrame(byte [] rawData, Camera camera) {         
            Log.v(TAG, "Preview callback start");            
            int rawDataLength = 0;
            if (rawData != null) {