Java Code Examples for android.os.Handler#obtainMessage()
The following examples show how to use
android.os.Handler#obtainMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PreviewCallback.java From Gizwits-SmartBuld_Android with MIT License | 5 votes |
@Override public void onPreviewFrame(byte[] data, Camera camera) { Point cameraResolution = configManager.getCameraResolution(); Handler thePreviewHandler = previewHandler; if (cameraResolution != null && thePreviewHandler != null) { Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x, cameraResolution.y, data); message.sendToTarget(); previewHandler = null; } else { Log.d(TAG, "Got preview callback, but no handler or resolution available"); } }
Example 2
Source File: PreviewCallback.java From ZXing-Standalone-library with Apache License 2.0 | 5 votes |
@Override public void onPreviewFrame(byte[] data, Camera camera) { Point cameraResolution = configManager.getCameraResolution(); Handler thePreviewHandler = previewHandler; if (cameraResolution != null && thePreviewHandler != null) { Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x, cameraResolution.y, data); message.sendToTarget(); previewHandler = null; } else { Log.d(TAG, "Got preview callback, but no handler or resolution available"); } }
Example 3
Source File: PreviewCallback.java From android-quick-response-code with Apache License 2.0 | 5 votes |
@Override public void onPreviewFrame(byte[] data, Camera camera) { Point cameraResolution = configManager.getCameraResolution(); Handler thePreviewHandler = previewHandler; if (thePreviewHandler != null) { Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x, cameraResolution.y, data); message.sendToTarget(); previewHandler = null; } else { Log.d(TAG, "Got preview callback, but no handler for it"); } }
Example 4
Source File: PreviewCallback.java From zxing with MIT License | 5 votes |
@Override public void onPreviewFrame(byte[] data, Camera camera) { Point cameraResolution = configManager.getCameraResolution(); Handler thePreviewHandler = previewHandler; if (cameraResolution != null && thePreviewHandler != null) { Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x, cameraResolution.y, data); message.sendToTarget(); previewHandler = null; } else { Log.d(TAG, "Got preview callback, but no handler or resolution available"); } }
Example 5
Source File: PreviewCallback.java From AndroidHttpCapture with MIT License | 5 votes |
@Override public void onPreviewFrame(byte[] data, Camera camera) { Point cameraResolution = configManager.getCameraResolution(); Handler thePreviewHandler = previewHandler; if (cameraResolution != null && thePreviewHandler != null) { Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x, cameraResolution.y, data); message.sendToTarget(); previewHandler = null; } else { Log.d(TAG, "Got preview callback, but no handler or resolution available"); } }
Example 6
Source File: TrackerManager.java From android_viewtracker with Apache License 2.0 | 5 votes |
/** * commit the data for exposure event in batch */ private void batchReport() { long time = System.currentTimeMillis(); Handler handler = ExposureManager.getInstance().getExposureHandler(); Message message = handler.obtainMessage(); message.what = ExposureManager.BATCH_COMMIT_EXPOSURE; handler.sendMessage(message); TrackerLog.v("batch report exposure views " + (System.currentTimeMillis() - time) + "ms"); }
Example 7
Source File: PreviewCallback.java From LLApp with Apache License 2.0 | 5 votes |
@Override public void onPreviewFrame(byte[] data, Camera camera) { Point cameraResolution = configManager.getCameraResolution(); Handler thePreviewHandler = previewHandler; if (thePreviewHandler != null) { Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x, cameraResolution.y, data); message.sendToTarget(); previewHandler = null; } else { Log.d(TAG, "Got preview callback, but no handler for it"); } }
Example 8
Source File: PreviewCallback.java From gokit-android with MIT License | 5 votes |
@Override public void onPreviewFrame(byte[] data, Camera camera) { Point cameraResolution = configManager.getCameraResolution(); Handler thePreviewHandler = previewHandler; if (cameraResolution != null && thePreviewHandler != null) { Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x, cameraResolution.y, data); message.sendToTarget(); previewHandler = null; } else { Log.d(TAG, "Got preview callback, but no handler or resolution available"); } }
Example 9
Source File: HandlerUtil.java From AndroidBase with Apache License 2.0 | 5 votes |
public static void sendMessage(Handler handler, int what, int arg1, Bundle bundle) { Message msg = handler.obtainMessage(); msg.what = what; msg.arg1 = arg1; msg.setData(bundle); // 发送消息 handler.sendMessage(msg); }
Example 10
Source File: AwWebContentsDelegateAdapter.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void showRepostFormWarningDialog(final ContentViewCore contentViewCore) { // TODO(mkosiba) We should be using something akin to the JsResultReceiver as the // callback parameter (instead of ContentViewCore) and implement a way of converting // that to a pair of messages. final int MSG_CONTINUE_PENDING_RELOAD = 1; final int MSG_CANCEL_PENDING_RELOAD = 2; // TODO(sgurun) Remember the URL to cancel the reload behavior // if it is different than the most recent NavigationController entry. final Handler handler = new Handler(ThreadUtils.getUiThreadLooper()) { @Override public void handleMessage(Message msg) { switch(msg.what) { case MSG_CONTINUE_PENDING_RELOAD: { contentViewCore.continuePendingReload(); break; } case MSG_CANCEL_PENDING_RELOAD: { contentViewCore.cancelPendingReload(); break; } default: throw new IllegalStateException( "WebContentsDelegateAdapter: unhandled message " + msg.what); } } }; Message resend = handler.obtainMessage(MSG_CONTINUE_PENDING_RELOAD); Message dontResend = handler.obtainMessage(MSG_CANCEL_PENDING_RELOAD); mContentsClient.onFormResubmission(dontResend, resend); }
Example 11
Source File: PreviewCallback.java From qrcode_android with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void onPreviewFrame(byte[] data, Camera camera) { Camera.Size cameraResolution = configManager.getCameraResolution(); Handler thePreviewHandler = previewHandler; if (cameraResolution != null && thePreviewHandler != null) { Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.width, cameraResolution.height, data); message.sendToTarget(); previewHandler = null; } else { Log.d(TAG, "Got preview callback, but no handler or resolution available"); } }
Example 12
Source File: PreviewCallback.java From BarcodeEye with Apache License 2.0 | 5 votes |
@Override public void onPreviewFrame(byte[] data, Camera camera) { Point cameraResolution = configManager.getCameraResolution(); Handler thePreviewHandler = previewHandler; if (cameraResolution != null && thePreviewHandler != null) { Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x, cameraResolution.y, data); message.sendToTarget(); previewHandler = null; } else { Log.d(TAG, "Got preview callback, but no handler or resolution available"); } }
Example 13
Source File: PreviewCallback.java From FamilyChat with Apache License 2.0 | 5 votes |
@Override public void onPreviewFrame(byte[] data, Camera camera) { Point cameraResolution = configManager.getCameraResolution(); Handler thePreviewHandler = previewHandler; if (cameraResolution != null && thePreviewHandler != null) { Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x, cameraResolution.y, data); message.sendToTarget(); previewHandler = null; } else { Log.d(TAG, "Got preview callback, but no handler or resolution available"); } }
Example 14
Source File: CleanUtil.java From CleanExpert with MIT License | 5 votes |
public static void freeJunkInfos(ArrayList<JunkInfo> junks, final Handler handler) { for (JunkInfo info : junks) { File file = new File(info.mPath); if (file != null && file.exists()) { file.delete(); } } Message msg = handler.obtainMessage(JunkCleanActivity.MSG_OVERALL_CLEAN_FINISH); msg.sendToTarget(); }
Example 15
Source File: AppWidgetHost.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public void viewDataChanged(int appWidgetId, int viewId) { Handler handler = mWeakHandler.get(); if (handler == null) { return; } Message msg = handler.obtainMessage(HANDLE_VIEW_DATA_CHANGED, appWidgetId, viewId); msg.sendToTarget(); }
Example 16
Source File: AppWidgetHost.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public void updateAppWidget(int appWidgetId, RemoteViews views) { if (isLocalBinder() && views != null) { views = views.clone(); } Handler handler = mWeakHandler.get(); if (handler == null) { return; } Message msg = handler.obtainMessage(HANDLE_UPDATE, appWidgetId, 0, views); msg.sendToTarget(); }
Example 17
Source File: PreviewCallback.java From reacteu-app with MIT License | 5 votes |
@Override public void onPreviewFrame(byte[] data, Camera camera) { Point cameraResolution = configManager.getCameraResolution(); Handler thePreviewHandler = previewHandler; if (cameraResolution != null && thePreviewHandler != null) { Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x, cameraResolution.y, data); message.sendToTarget(); previewHandler = null; } else { Log.d(TAG, "Got preview callback, but no handler or resolution available"); } }
Example 18
Source File: PreviewCallback.java From GOpenSource_AppKit_Android_AS with MIT License | 5 votes |
@Override public void onPreviewFrame(byte[] data, Camera camera) { Point cameraResolution = configManager.getCameraResolution(); Handler thePreviewHandler = previewHandler; if (cameraResolution != null && thePreviewHandler != null) { Message message = thePreviewHandler.obtainMessage(previewMessage, cameraResolution.x, cameraResolution.y, data); message.sendToTarget(); previewHandler = null; } else { Log.d(TAG, "Got preview callback, but no handler or resolution available"); } }
Example 19
Source File: DispatchService.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 4 votes |
public Message obtainRequest(Handler handler, String action, Uri uri) { Message msg = handler.obtainMessage(REQUEST, action.hashCode(), Uris.getDescriptor(uri)); return msg; }
Example 20
Source File: HandlerUtil.java From AndroidBase with Apache License 2.0 | 3 votes |
public static void sendMessage(Handler handler, int what, Object obj) { Message msg = handler.obtainMessage(); msg.what = what; msg.obj = obj; // 发送消息 handler.sendMessage(msg); }