Interface MainThread


public interface MainThread
Provide access to the main or first Thread where certain APIs need the ability to run tasks on the thread that initially started the VM. Instances of MainThread should be obtained from the Hub Lookup.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Query whether the currently executing thread is the main thread.
    void
    Run the provided task on the main thread.
  • Method Details

    • runLater

      void runLater(Runnable task)
      Run the provided task on the main thread. Tasks should not block and should run for as little time as possible. The task will run asynchronously.
      Parameters:
      task - Runnable task to execute.
    • isMainThread

      boolean isMainThread()
      Query whether the currently executing thread is the main thread.
      Returns:
      true if the current thread is the main thread, false otherwise.