List of usage examples for android.os Message Message
public Message()
From source file:com.iiordanov.bVNC.RemoteCanvas.java
@Override public boolean OnVerifiyCertificate(String subject, String issuer, String fingerprint) { android.util.Log.e(TAG, "OnVerifiyCertificate called."); // Send a message containing the certificate to our handler. Message m = new Message(); m.setTarget(handler);// w w w.j a v a2 s . co m m.what = Constants.DIALOG_RDP_CERT; Bundle strings = new Bundle(); strings.putString("subject", subject); strings.putString("issuer", issuer); strings.putString("fingerprint", fingerprint); m.obj = strings; handler.sendMessage(m); // Block while user decides whether to accept certificate or not. // The activity ends if the user taps "No", so we block indefinitely here. synchronized (RemoteCanvas.this) { while (!certificateAccepted) { try { RemoteCanvas.this.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } return true; }
From source file:com.fvd.nimbus.BrowseActivity.java
@Override public void onSelectionChanged(final String plainText, final String html, Rect menuRect) { try {/* www .j a v a2s .c o m*/ //Log.i("nimbus", plainText); if (progressDialog != null) { progressDialog.dismiss(); } /*appSettings.appendLog(html); Toast.makeText(getApplicationContext(), "Saved", Toast.LENGTH_LONG).show(); return;*/ /*selHtml=""; selBuff="";*/ //Log.e("fvdWebView","SelectionChanged hb:"); if (plainText.equals("action:savePage")) { if (html.length() > 0) { if (sessionId.length() == 0) { clipData.setContent(html); clipData.setTitle(wv.getTitle()); showSettings(); } else { sendNote(wv.getTitle(), html, parent, tag); wv.endSelectionMode(); } } } else if (plainText.equals("action:saveArticle")) { if (html.length() > 0) { //appSettings.appendLog(html); clipData.setContent(html); clipData.setTitle(wv.getTitle()); Intent i = new Intent(getApplicationContext(), previewActivity.class); i.putExtra("url", wv.getUrl()); i.putExtra("title", wv.getTitle()); i.putExtra("content", clipData); startActivityForResult(i, 5); //overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up ); overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out); } } else { if (plainText.equals("action:selectionChanged")) { String selHtml = html == null ? "" : html; Message msg = new Message(); msg.arg1 = selHtml.length() > 0 ? 1 : 0; msg.what = 0; clipData.setContent(html); clipData.setTitle(wv.getTitle()); handler.sendMessage(msg); } } } catch (Exception e) { BugReporter.Send("onSelectionChanged", e.getMessage()); //Log.e("fvdWebView","onSelectionChanged: "+e.getMessage()); } /*if(this.contextMenuVisible){ return; } if(menuRect.right <= menuRect.left){ return; } mContextMenu = new QuickAction(this); mContextMenu.setOnDismissListener(this); mContextMenu.addActionItem(buildActionItem("Send to Nimbus",1,R.drawable.menu_search)); mContextMenu.addActionItem(buildActionItem("Button 2",2,R.drawable.menu_info)); mContextMenu.addActionItem(buildActionItem("Button 3",3,R.drawable.menu_eraser)); mContextMenu.setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() { @Override public void onItemClick(QuickAction source, int pos, int actionId) { // TODO Auto-generated method stub switch (actionId) { case 1: //serverHelper.getInstance().uploadNote("test", "<html><body>" + plainText + "</body></html>"); sendNote(wv.getTitle(), html); mContextMenu.dismiss(); wv.endSelectionMode(); break; default: break; } contextMenuVisible = false; } }); this.contextMenuVisible = true; mContextMenu.show(wv, menuRect);*/ }
From source file:com.findcab.activity.LocationOverlay.java
/** * // w w w.j ava 2 s .c o m * * @param start * simsunny */ private void countBackwards() { // isWaiting = true; if (isStartCount) { new Thread(new Runnable() { @Override public void run() { while (isWaiting) { try { Thread.currentThread().sleep(1000); Message msg = new Message(); waitingTime--; msg.what = WAITING; waitingHandler.sendMessage(msg); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }).start(); } }
From source file:com.nbplus.iotapp.service.IoTService.java
/** * ?? ? ? .//w w w . ja v a2 s.c o m */ private void sendServiceStatusNotification() { if (PackageUtils.isActivePackage(this, getApplicationContext().getPackageName() + ":remote")) { Log.d(TAG, "Remote process(RealtimeBroadcast..) is running..."); return; } Messenger clientMessenger = (mRegisteredAppMessenger == null) ? null : mRegisteredAppMessenger.get(); if (clientMessenger != null) { Message response = new Message(); response.what = IoTServiceCommand.SERVICE_STATUS_NOTIFICATION; // ?? Bundle ? request command (int) result code (serializable) ?. Bundle b = new Bundle(); b.putString(IoTServiceCommand.KEY_MSGID, /*this.getApplicationContext().*/getPackageName() + "_" + System.currentTimeMillis()); b.putSerializable(IoTServiceCommand.KEY_SERVICE_STATUS, mServiceStatus); b.putSerializable(IoTServiceCommand.KEY_SERVICE_STATUS_CODE, mErrorCodes); response.setData(b); try { clientMessenger.send(response); } catch (RemoteException e) { e.printStackTrace(); } } }
From source file:com.nbplus.iotapp.service.IoTService.java
/** * ?? Request? ./*w w w .jav a2s . c om*/ * ? Async ? ? ? ? ? ? ? ?? . * * @param clientMessenger * @param msgId * @param command * @param result */ private void sendResultToApplication(Messenger clientMessenger, String msgId, String deviceId, int command, IoTResultCodes result) { if (clientMessenger != null) { Message response = new Message(); response.what = IoTServiceCommand.COMMAND_RESPONSE; // ?? Bundle ? request command (int) result code (serializable) ?. Bundle b = new Bundle(); b.putString(IoTServiceCommand.KEY_MSGID, msgId); b.putInt(IoTServiceCommand.KEY_CMD, command); b.putString(IoTServiceCommand.KEY_DEVICE_UUID, deviceId); b.putSerializable(IoTServiceCommand.KEY_RESULT, result); response.setData(b); try { clientMessenger.send(response); } catch (RemoteException e) { e.printStackTrace(); } } }
From source file:com.zld.ui.ZldNewActivity.java
public void carUserPayed(String carNumber, String collect) { Log.e("--", carNumber); Message msg = new Message(); msg.obj = collect;//from w w w . j a v a 2s .c o m handle.sendMessage(msg); }
From source file:com.dzt.musicplay.player.AudioService.java
private void showToast(String text, int duration) { Message msg = new Message(); Bundle bundle = new Bundle(); bundle.putString("text", text); bundle.putInt("duration", duration); msg.setData(bundle);//from w w w . j a v a2s . c om msg.what = SHOW_TOAST; mHandler.sendMessage(msg); }
From source file:android.webkit.cts.WebViewTest.java
public void testDocumentHasImages() throws Exception, Throwable { if (!NullWebViewUtils.isWebViewAvailable()) { return;/* www.j a va 2s. co m*/ } final class DocumentHasImageCheckHandler extends Handler { private boolean mReceived; private int mMsgArg1; public DocumentHasImageCheckHandler(Looper looper) { super(looper); } @Override public void handleMessage(Message msg) { synchronized (this) { mReceived = true; mMsgArg1 = msg.arg1; } } public synchronized boolean hasCalledHandleMessage() { return mReceived; } public synchronized int getMsgArg1() { return mMsgArg1; } } startWebServer(false); final String imgUrl = mWebServer.getAssetUrl(TestHtmlConstants.SMALL_IMG_URL); // Create a handler on the UI thread. final DocumentHasImageCheckHandler handler = new DocumentHasImageCheckHandler( mWebView.getHandler().getLooper()); runTestOnUiThread(new Runnable() { @Override public void run() { mOnUiThread.loadDataAndWaitForCompletion("<html><body><img src=\"" + imgUrl + "\"/></body></html>", "text/html", null); Message response = new Message(); response.setTarget(handler); assertFalse(handler.hasCalledHandleMessage()); mWebView.documentHasImages(response); } }); new PollingCheck() { @Override protected boolean check() { return handler.hasCalledHandleMessage(); } }.run(); assertEquals(1, handler.getMsgArg1()); }
From source file:com.gizwits.smartlight.activity.MainListActivity.java
/** * ????/* ww w . j a v a 2s . c o m*/ */ public void getLedStatus() { for (int i = 0; i < ledList.size(); i++) { Message msg = new Message(); msg.what = handler_key.DEVICE_GETSTATUS.ordinal(); msg.obj = ledList.get(i).getSubDevice(); handler.sendMessage(msg); } }
From source file:com.almalence.opencam.PluginManagerBase.java
public void sendMessage(int what, String obj, int arg1, int arg2) { Message message = new Message(); message.obj = String.valueOf(obj); message.arg1 = arg1;/*w ww.j a v a2s .c om*/ message.arg2 = arg2; message.what = what; ApplicationScreen.getMessageHandler().sendMessage(message); }