Class ShadowLegacyMessage

java.lang.Object
org.robolectric.shadows.ShadowMessage
org.robolectric.shadows.ShadowLegacyMessage

@Implements(value=android.os.Message.class, isInAndroidSdk=false) public class ShadowLegacyMessage extends ShadowMessage
The shadow Message for LooperMode.Mode.LEGACY.

In LooperMode.Mode.LEGACY, each Message is associated with a Runnable posted to the Scheduler.

See Also:
  • Constructor Details

    • ShadowLegacyMessage

      public ShadowLegacyMessage()
  • Method Details

    • recycleUnchecked

      @HiddenApi @Implementation public void recycleUnchecked()
      Hook to unscheduled the callback when the message is recycled. Invokes unschedule() and then calls through to the package private method Message.recycleUnchecked() on the real object.
      Specified by:
      recycleUnchecked in class ShadowMessage
    • setScheduledRunnable

      public void setScheduledRunnable(Runnable r)
      Description copied from class: ShadowMessage
      Stores the Runnable instance that has been scheduled to invoke this message. This is called when the message is enqueued by ShadowLegacyMessageQueue.enqueueMessage(android.os.Message, long) and is used when the message is recycled to ensure that the correct Runnable instance is removed from the associated scheduler.
      Specified by:
      setScheduledRunnable in class ShadowMessage
      Parameters:
      r - the Runnable instance that is scheduled to trigger this message.

      #if ($api >= 21) * @see #recycleUnchecked() #else * @see #recycle() #end

      Only supported in LooperMode.Mode.LEGACY.

    • getNext

      public Message getNext()
      Description copied from class: ShadowMessage
      Convenience method to provide getter access to the private field Message.next.

      Only supported in LooperMode.Mode.LEGACY

      Specified by:
      getNext in class ShadowMessage
      Returns:
      The next message in the current message chain.
      See Also:
    • setNext

      public void setNext(Message next)
      Description copied from class: ShadowMessage
      Convenience method to provide setter access to the private field Message.next.

      Only supported in LooperMode.Mode.LEGACY

      Specified by:
      setNext in class ShadowMessage
      Parameters:
      next - the new next message for the current message.
      See Also: