Android Looper - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Looper class.

This code example shows how to use the following methods: getThread, quit
     
    /* 
     * 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;
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: quit
    /* 
     * Terminates the listener looper thread. 
     */ 
    private void terminateListenerLooper() { 
        if (mLooper != null) {
            mLooper.quit();
            mLooper = null;
        } 
    } 
 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: quit, sleep
     
    /* 
     * Terminates the message looper thread. 
     */ 
    private void terminateMessageLooper() { 
        mLooper.quit();
        //TODO yslau : take out the sleep until bug#1693519 fix 
        try { 
            Thread.sleep(1000);
        } catch (Exception e){
            Log.v(TAG, e.toString());
        } 
        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;
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: quit
     
    /* 
     * Terminates the message looper thread. 
     */ 
    private static void terminateMessageLooper() { 
        mLooper.quit();
        mMediaPlayer.release();
    } 
     
    static MediaPlayer.OnPreparedListener mPreparedListener = new MediaPlayer.OnPreparedListener() {
        public void onPrepared(MediaPlayer mp) { 
            synchronized (prepareDone) { 
                if(mPrepareReset){ 
                    Log.v(TAG, "call Reset"); 
                    mMediaPlayer.reset(); 
                } 
                Log.v(TAG, "notify the prepare callback"); 
                prepareDone.notify(); 
                onPrepareSuccess = true; 
            } 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: quit
 
    public void stopLooping() { 
      if (looper == null) {
        return; 
      } 
      looper.quit();
    } 
  } 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android Looper Questions & Answers:

See Code Examples for Android Looper Methods: