Android English document translation series (2)--handlerthread

Source: Internet
Author: User

 public class handlerthreadextends Thread class  overviewhandy class for starting a new Thread that H As a looper. The looper can than is used to create handler classes. Note That start () mast Still not Called. handy class for starting a new thread this has a looper.//this is a very easy to Get a looper to open a new thread class. (This is a class that facilitates the creation of new threads and owns Looper) the Looper can than is used to create handler classes.//can take advantage of this looper creating a box of handler classes. (i.e. handler with Looper) Note that start () Mast still not called.//Notice that the start () method has not yet been called.  public constructor//Common constructor public handlerthread (string name) publicly Handlerthread (string Name,int priority) Parameters//Parameter priority the "the" to run the thread at. The values supplied must is from the procces and is from the java.lang.thread.//priority is run online thread, and its value must be supported in the process and not the thread.  public methodpublic Looper Getlooper () The method returns the Looper associated whit this thread. If This thread isn't been started or for any reason is Alive () returns False,this method would returnNull. If This thread has been Started,this method would brock until the Looper has been Initialized. the method returns The looper associated Whit this method will return a looper that is associated with the thread. If this thread isn't been started or for any reason is isAlive () returns False,this method would return null.//if the threads are not executed or because For any reason  isalive () returns False, this method will return null. If this thread had been Started,this method will brock until the Looper have been initialized.//if the threads have already started running, this method would block Unless Looper has been initialized.  public int GetThreadId () Retunrs The IND identifier of this thread. see procces.mypid.//returns the identifier for this thread, see Procces.mypid.  public Boolean quit () Ask the CurrentY running looper to quit. If the thread has a not been started or have finished (that is if getlooper () returns null) and then false is returned. Otherwise  the Looper is asked quit and true is return.//call is currently running in the Looper message loop exits. If the thread does not start or the thread has finished executing (Getlooper will return null), it returns false. Otherwise, the message loop exits and returns True.  public void Run () Calls the Run () method of the Runnable objECT the receiver holds. The If no Runnable set,does nothing.//runnable  object calls this method ... Do not know, if there is no object settings, do not do anything.

Android English document translation series (2)--handlerthread

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.