Android英文文檔翻譯系列(2)——HandlerThread

來源:互聯網
上載者:User

標籤: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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.