<Linearlayout
Android: Orientation = "horizontal"
Android: layout_width = "fill_parent">
<Textview
Android: Id = "@ + ID/instruction"
Android: layout_width = "fill_parent"
Android: layout_weight = "0.8"
/>
<Textview
Android: Id = "@ + ID/lend"
Android: layout_width = "fill_parent"
Android: shadowradius = "0.3"/>
</Linearlayout>
Handler usage thread
The run function implemented by the runable interface does not start a new thread, but is executed in the current thread.
Runnable r = new runable (){
Public void run (){
// Program Execution Code }}
Handler and the activity using the thread are in the same thread.
Private handler = new handler ();
Thread. currentthread (). GETID ();
Thread. currentthread (). getname ();
This is different from the standard Java implementation thread.
Thread t = new thread (R );
T. Start (); in this way, the thread and the main thread are different ......
Handler. Post (r); the start method of the thread is not called.
Bundle object: using string as the key is a special table map and a data storage tool.
Loop class: provides a loop to take a rest from the queue.
The handlerthread class can process the waiting threads cyclically (Message Queue)
Handlerthread. getlooper
Handler. handlemassge
Handler. obtainmessage
Message. sendtotarget (handler)
Message. OBJ; transmits a small amount of data
Message. setdata (bundle)
Bundle B = new bundle ();
B. putint ("Age", 20 );
B. putstring ("name", Joy) O (character _ blank) O Haha ~ Nice
Int age = B. getdata ("name ");
Before using getlooper of handlerthread, you must call handthread of this class. Start ();
Asynchronous Message Processing: handlemessage in the new thread
Modify the mainfest file before execution