Code example for Handler

Methods: obtainMessagesendMessageDelayed

0
    this.autoFocusMessage = autoFocusMessage;
  } 
 
  public void onAutoFocus(boolean success, Camera camera) {
    if (autoFocusHandler != null) {
      Message message = autoFocusHandler.obtainMessage(autoFocusMessage, success);
      // Simulate continuous autofocus by sending a focus request every 
      // AUTOFOCUS_INTERVAL_MS milliseconds. 
      //Log.d(TAG, "Got auto-focus callback; requesting another"); 
      autoFocusHandler.sendMessageDelayed(message, AUTOFOCUS_INTERVAL_MS);
      autoFocusHandler = null;
    } else { 
      Log.d(TAG, "Got auto-focus callback, but no handler for it");
    } 
  } 
 
}