Java Code Examples for android.os.Message#copyFrom()
The following examples show how to use
android.os.Message#copyFrom() .
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: CommandService.java From renrenpay-android with Apache License 2.0 | 6 votes |
private void genQR(Message msg, boolean isAlipay) { try { Message clone = Message.obtain(); clone.copyFrom(msg); if (isAlipay) { mAlipayClient.send(clone); } else { if (mWeChatClient == null) { EventBus.getDefault().noticeMsg("we chat client 为空"); } else { mWeChatClient.send(clone); } } } catch (RemoteException e) { Log.e(TAG, e.getMessage()); } }
Example 2
Source File: CollectActivity.java From Field-Book with GNU General Public License v2.0 | 6 votes |
@Override public void handleMessage(Message msg) { synchronized (lock) { switch (msg.what) { case 1: ImageView btn = findViewById(msg.arg1); if (btn.getTag() != null) { // button is still pressed // schedule next btn pressed check Message msg1 = new Message(); msg1.copyFrom(msg); if (msg.arg1 == R.id.rangeLeft) { rangeBox.repeatKeyPress("left"); } else { rangeBox.repeatKeyPress("right"); } myGuiHandler.removeMessages(1); myGuiHandler.sendMessageDelayed(msg1, msg1.arg2); } break; } } }
Example 3
Source File: SdlRouterService.java From sdl_java_suite with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void notifyClients(final Message message){ if(message==null){ Log.w(TAG, "Can't notify clients, message was null"); return; } Log.d(TAG, "Notifying "+ registeredApps.size()+ " clients"); int result; synchronized(REGISTERED_APPS_LOCK){ Collection<RegisteredApp> apps = registeredApps.values(); Iterator<RegisteredApp> it = apps.iterator(); Message formattedMessage = new Message(); while(it.hasNext()){ RegisteredApp app = it.next(); formattedMessage.copyFrom(message); //Format the message for the receiving app and appropriate messaging version if(formatMessage(app, formattedMessage)) { result = app.sendMessage(formattedMessage); if (result == RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT) { app.close(); it.remove(); } } } } }
Example 4
Source File: CommandService.java From renrenpay-android with Apache License 2.0 | 5 votes |
private void alipayQRComplete(Message msg) { try { Message clone = Message.obtain(); clone.copyFrom(msg); mTestClient.send(clone); } catch (RemoteException e) { Log.e(TAG, e.getMessage()); } }
Example 5
Source File: CommandService.java From AlipayQRHook with Apache License 2.0 | 5 votes |
private void genQR(Message msg, boolean isAlipay) { try { Message clone = Message.obtain(); clone.copyFrom(msg); if(isAlipay) { mAlipayClient.send(clone); }else{ mWeChatClient.send(clone); } } catch (RemoteException e) { Log.e(TAG, e.getMessage()); } }
Example 6
Source File: CommandService.java From AlipayQRHook with Apache License 2.0 | 5 votes |
private void alipayQRComplete(Message msg) { try { Message clone = Message.obtain(); clone.copyFrom(msg); mTestClient.send(clone); } catch (RemoteException e) { Log.e(TAG, e.getMessage()); } }
Example 7
Source File: StateMachine.java From apollo-DuerOS with Apache License 2.0 | 5 votes |
/** @see StateMachine#deferMessage(Message) */ private final void deferMessage(Message msg) { if (mDbg) { Log.d(TAG, "deferMessage: msg=" + msg.what); } /* Copy the "msg" to "newMsg" as "msg" will be recycled */ Message newMsg = obtainMessage(); newMsg.copyFrom(msg); mDeferredMessages.add(newMsg); }
Example 8
Source File: GroupSubThreadStateManager.java From Aria with Apache License 2.0 | 5 votes |
public void sendMessageFromMsg(Message msg){ Message mMsg=mHandler.obtainMessage(); Bundle b=mMsg.getData(); b.putString(IThreadStateManager.DATA_THREAD_NAME,mKey); msg.setData(b); mMsg.copyFrom(msg); mHandler.sendMessage(mMsg); }
Example 9
Source File: PauseHandler.java From DeviceConnect-Android with MIT License | 5 votes |
@Override public final void handleMessage(final Message msg) { if (mPaused) { if (storeMessage(msg)) { Message msgCopy = new Message(); msgCopy.copyFrom(msg); mMessageQueueBuffer.add(msgCopy); } } else { processMessage(msg); } }
Example 10
Source File: Broadcaster.java From Zom-Android-XMPP with GNU General Public License v3.0 | 5 votes |
/** * Send out msg. Anyone who has registered via the request() method will be * sent the message. */ public void broadcast(Message msg) { synchronized (this) { if (mReg == null) { return; } int senderWhat = msg.what; Registration start = mReg; Registration r = start; do { if (r.senderWhat >= senderWhat) { break; } r = r.next; } while (r != start); if (r.senderWhat == senderWhat) { Handler[] targets = r.targets; int[] whats = r.targetWhats; int n = targets.length; for (int i = 0; i < n; i++) { Handler target = targets[i]; Message m = Message.obtain(); m.copyFrom(msg); m.what = whats[i]; if (target != null) target.sendMessage(m); } } } }