Android Message - 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 Message class.

This code example shows how to use the following methods: setData
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        return sendMessageDelayed(msg, 0L);
    } 
 
    @Implementation 
    public final boolean sendMessageDelayed(final Message msg, long delayMillis) {
        Robolectric.shadowOf(msg).setWhen(Robolectric.shadowOf(looper).getScheduler().getCurrentTime()+delayMillis);
        messages.add(msg);
        postDelayed(new Runnable() {
            @Override 
            public void run() { 
                if (messages.contains(msg)) {
                    messages.remove(msg);
                    routeMessage(msg);
                } 
            } 
        }, delayMillis);
        return true; 
    } 
 
    private void routeMessage(Message msg) {

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: sendToTarget, setTarget
    this.handler = handler;
  } 
 
  @Implementation 
  public void send(Message message) throws RemoteException {
    message.setTarget(handler);
    message.sendToTarget();
  } 
} 
Full Snippet Info
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
		public JavaScriptInterface(NewsblurWebview bookmarkWebView) {
			view = bookmarkWebView;
		} 
 
	    public void scroll(final int i ) {
	    	Message msg = new Message();
	    	msg.obj = Integer.valueOf(i);
	    	msg.what = 0;
	    	handler.dispatchMessage(msg);
	    } 
	} 
	 
 
	public void setHandler(Handler h) {
		this.handler = h;
		loadUrl("javascript:window.onload=webview.scroll(document.body.scrollHeight)");
	} 
 
	public void setTextSize(float textSize) {
		Log.d("Reading", "Setting textsize to " + (AppConstants.FONT_SIZE_LOWER_BOUND + textSize));
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: sendToTarget, setTarget
        this.handler = handler;
    } 
 
    @Implementation 
    public void send(Message message) throws RemoteException {
        message.setTarget(handler);
        message.sendToTarget();
    } 
} 
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setTarget
  } 
  @Override 
  protected boolean onCreateWindow(boolean isDialog, boolean isUserGesture) {
    if (webClient_ != null) {
      // TODO(pwnall): figure out what to do here 
      Message resultMsg = new Message();
      resultMsg.setTarget(null);
      resultMsg.obj = null; // WebView.WebViewTransport
      return webClient_.onCreateWindow(view_, isDialog,
          isUserGesture, resultMsg);
    } else { 
      return false; 
    } 
  } 
  @Override 
  protected void onRequestFocus() { 
    if (webClient_ != null)
      webClient_.onRequestFocus(view_); 
  } 
  @Override 
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: sendToTarget
    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");
    } 
  } 
 
} 
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: recycle
        // If we are calling this from the main thread, then we can call 
        // right through.  Otherwise, we need to send the message to the 
        // main thread. 
        if (Looper.myLooper() == mMainLooper) {
            executeMessage(msg);
            msg.recycle();
            return; 
        } 
         
        mH.sendMessage(msg);
    } 
     
    void executeMessage(Message msg) {
        switch (msg.what) {
            case DO_GET_TEXT_AFTER_CURSOR: {
                SomeArgs args = (SomeArgs)msg.obj;
                try { 
                    InputConnection ic = mInputConnection.get();
                    if (ic == null || !isActive()) {
                        Log.w(TAG, "getTextAfterCursor on inactive InputConnection");
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: copyFrom
		int retry = getRetryCount(msg);
		boolean isFinished = mListener.onHandleIntent((Intent)msg.obj, retry, getAmountTime(msg));
		 
		if (!isFinished && retry < COUNT_MASK) {
			// backoff delay 
			Message newMessage = new Message();
			newMessage.copyFrom(msg);
			int next = calcNextTime(newMessage);
			sendMessageDelayed(newMessage, next * 1000);
		} else { 
			mListener.stopSelf(msg.arg1);
		} 
	} 
 
	/** 
	 * exponential backoff 
	 * @param msg 
	 * @return 
	 */ 
	private int calcNextTime(Message msg) {
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: setTarget
 
    @Override 
    protected boolean onCreateWindow(boolean isDialog, boolean isUserGesture) {
        if (mWebChromeClient != null) {
            // TODO(pwnall): figure out what to do here 
            Message resultMsg = new Message();
            resultMsg.setTarget(null);
            resultMsg.obj = null; // WebView.WebViewTransport
            return mWebChromeClient.onCreateWindow(mWebView, isDialog,
                    isUserGesture, resultMsg);
        } else { 
            return false; 
        } 
    } 
 
    @Override 
    protected void onRequestFocus() { 
        if (mWebChromeClient != null)
            mWebChromeClient.onRequestFocus(mWebView);
    } 
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Android Message Questions & Answers:

See Code Examples for Android Message Methods: