Search in sources :

Example 11 with Message

use of android.os.Message in project okhttp-OkGo by jeasonlzy.

the class PriorityAsyncTask method postResult.

private Result postResult(Result result) {
    @SuppressWarnings("unchecked") Message message = sHandler.obtainMessage(MESSAGE_POST_RESULT, new AsyncTaskResult<Result>(this, result));
    message.sendToTarget();
    return result;
}
Also used : Message(android.os.Message)

Example 12 with Message

use of android.os.Message in project SmartAndroidSource by jaychou2012.

the class AsyncHttpResponseHandler method obtainMessage.

/**
     * Helper method to create Message instance from handler
     *
     * @param responseMessageId   constant to identify Handler message
     * @param responseMessageData object to be passed to message receiver
     * @return Message instance, should not be null
     */
protected Message obtainMessage(int responseMessageId, Object responseMessageData) {
    Message msg;
    if (handler == null) {
        msg = Message.obtain();
        if (msg != null) {
            msg.what = responseMessageId;
            msg.obj = responseMessageData;
        }
    } else {
        msg = Message.obtain(handler, responseMessageId, responseMessageData);
    }
    return msg;
}
Also used : Message(android.os.Message)

Example 13 with Message

use of android.os.Message in project SmartAndroidSource by jaychou2012.

the class AsyncTask method postResult.

private Result postResult(Result result) {
    @SuppressWarnings("unchecked") Message message = sHandler.obtainMessage(MESSAGE_POST_RESULT, new AsyncTaskResult<Result>(this, result));
    message.sendToTarget();
    return result;
}
Also used : Message(android.os.Message)

Example 14 with Message

use of android.os.Message in project Crouton by keyboardsurfer.

the class Manager method sendMessageDelayed.

/**
   * Sends a {@link Crouton} within a delayed {@link Message}.
   *
   * @param crouton
   *     The {@link Crouton} that should be sent.
   * @param messageId
   *     The {@link Message} id.
   * @param delay
   *     The delay in milliseconds.
   */
private void sendMessageDelayed(Crouton crouton, final int messageId, final long delay) {
    Message message = obtainMessage(messageId);
    message.obj = crouton;
    sendMessageDelayed(message, delay);
}
Also used : Message(android.os.Message)

Example 15 with Message

use of android.os.Message in project Klyph by jonathangerbaud.

the class BirthdayService method onStartCommand.

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Message msg = mServiceHandler.obtainMessage();
    msg.arg1 = startId;
    mServiceHandler.sendMessage(msg);
    // If we get killed, after returning from here, restart
    return START_STICKY;
}
Also used : Message(android.os.Message)

Aggregations

Message (android.os.Message)3198 Handler (android.os.Handler)347 RemoteException (android.os.RemoteException)263 Bundle (android.os.Bundle)210 Test (org.junit.Test)144 Intent (android.content.Intent)130 IOException (java.io.IOException)124 Point (android.graphics.Point)86 HashMap (java.util.HashMap)77 SomeArgs (com.android.internal.os.SomeArgs)67 SmallTest (android.test.suitebuilder.annotation.SmallTest)64 Messenger (android.os.Messenger)63 ArrayList (java.util.ArrayList)59 View (android.view.View)52 File (java.io.File)50 MediumTest (android.test.suitebuilder.annotation.MediumTest)43 TextView (android.widget.TextView)41 IBinder (android.os.IBinder)38 Map (java.util.Map)37 PendingIntent (android.app.PendingIntent)33