Build 1.0_r1(from source)

android.os
Class HandlerThread

java.lang.Object
  extended by java.lang.Thread
      extended by android.os.HandlerThread
All Implemented Interfaces:
Runnable

public class HandlerThread
extends Thread

Handy class for starting a new thread that has a looper. The looper can then be used to create handler classes. Note that start() must still be called.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
HandlerThread(String name)
           
HandlerThread(String name, int priority)
          Constructs a HandlerThread.
 
Method Summary
 Looper getLooper()
          This method returns the Looper associated with this thread.
 int getThreadId()
          Returns the identifier of this thread.
protected  void onLooperPrepared()
          Call back method that can be explicitly over ridden if needed to execute some setup before Looper loops.
 void run()
          Calls the run() method of the Runnable object the receiver holds.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HandlerThread

public HandlerThread(String name)

HandlerThread

public HandlerThread(String name,
                     int priority)
Constructs a HandlerThread.

Parameters:
name -
priority - The priority to run the thread at. The value supplied must be from Process and not from java.lang.Thread.
Method Detail

onLooperPrepared

protected void onLooperPrepared()
Call back method that can be explicitly over ridden if needed to execute some setup before Looper loops.


run

public void run()
Description copied from class: Thread
Calls the run() method of the Runnable object the receiver holds. If no Runnable is set, does nothing.

Specified by:
run in interface Runnable
Overrides:
run in class Thread
See Also:
Thread.start()

getLooper

public Looper getLooper()
This method returns the Looper associated with this thread. If this thread not been started or for any reason is isAlive() returns false, this method will return null. If this thread has been started, this method will blocked until the looper has been initialized.

Returns:
The looper.

getThreadId

public int getThreadId()
Returns the identifier of this thread. See Process.myTid().


Build 1.0_r1(from source)

Please submit a feedback, bug or feature