Methods Summary |
---|
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.
if (!isAlive()) {
return null;
}
// If the thread has been started, wait until the looper has been created.
synchronized (this) {
while (isAlive() && mLooper == null) {
try {
wait();
} catch (InterruptedException e) {
}
}
}
return mLooper;
|
public int | getThreadId()Returns the identifier of this thread. See Process.myTid().
return mTid;
|
protected void | onLooperPrepared()Call back method that can be explicitly over ridden if needed to execute some
setup before Looper loops.
|
public void | run()
mTid = Process.myTid();
Looper.prepare();
synchronized (this) {
mLooper = Looper.myLooper();
Process.setThreadPriority(mPriority);
notifyAll();
}
onLooperPrepared();
Looper.loop();
mTid = -1;
|