標籤:android blog io ar sp for java on div
public class HandlerThreadextends Thread Class OverviewHandy class for starting a new thread that has a looper.The looper can than be used to create handler classes.Note that start() mast still not called. Handy class for starting a new thread that has a looper.//這是一個可以很便捷地擷取一個Looper來開啟一個新線程的類。(這是一個方便建立新線程並擁有looper的類)The looper can than be used to create handler classes.//可以利用這個looper建立一盒Handler類。(也就是帶looper的handler)Note that start() mast still not called.//注意此時start()方法還沒調用。 Public Constructor//公用構造器public HandlerThread(String name)public HandlerThread(String name,int priority)parameters //參數priority The priority to run the thread at.The values supplied must be from Procces and not from java.lang.Thread.//優先順序 這個優先順序是運行線上程裡的,它的值必須是是進程中支援的而非線程。 Public Methodpublic Looper getLooper()The method returns the looper associated whit this thread.If this thread not been started or for any reason is Alive() returns false,this method will return null.If this thread has been started,this method will brock until the looper has been initialized. The method returns the looper associated whit this thread.//這個方法將會返回一個和線程關聯的looper。If this thread not been started or for any reason is isAlive() returns false,this method will return null.//如果這個線程沒被執行或者由於任何原因 isAlive()返回假的時候,這個方法將會返回空。If this thread has been started,this method will brock until the looper has been initialized.//如果這個線程已經開始運行了,這個方法將會阻塞除非looper已經被初始化。 public int getThreadId()Retunrs the ind identifier of this thread.See Procces.myPid.//返回這個線程的標識符,見Procces.myPid。 public boolean quit()Ask the currenty running looper to quit.If this thread has not been started or has finished(that is if getLooper() returns null),then false is returned.Otherwise the looper is asked quit and true is return.//呼叫當前正在運行中的looper訊息迴圈退出。如果這個線程沒有開始或者線程已經執行完畢(getLooper 將返回空),就返回假。否則將退出訊息迴圈並返回真。 public void run()Calls the run() method of the Runnable object the receiver holds.If no Runnable set,does nothing.//Runnable 對象調用這個方法...不懂,如果沒有對象設定,就不做任何事。
Android英文文檔翻譯系列(2)——HandlerThread