Background requirementsIn Android, when you encounter a child thread that needs to refresh the UI, the most common practice is handler, and of course there are other handy ways such as Android gives us the Runonuithread (runnable) method, But it all boils down to using handler to refresh the UI.How Android Message delivery works
Simple : Handler sends (post or send) a message; MessageQueue (the team, actually a queue implemented with a single-linked list) accepts and stores the message;
message loop mechanism in the Android system.Android uses Looper, handler to implement the message loop mechanism.The message loop for Android is thread-specific, and each thread can have its own message queue and message loop.The Looper in the Android system is responsible for managing thread Message Queuing and message loops.Gets the Looper object of the curre
uses Looper, handler to implement the message loop mechanism. The message loop for Android is thread-specific. Each thread can have its own message queue and message loop.The Looper in the Android system is responsible for managing thread Message Queuing and message loops. The Looper object of the current thread is obtained through Looper.mylooper (), and the
Handler diagram of the execution process:When our child thread wants to modify the UI component in the activity, we can create a new handler object to send the message to the main thread, and the information we send will wait for the MessageQueue of the main thread and be fetched by Looper in first-in, first-out order. It is then distributed to the corresponding handler according to the What property of the message object to handle!Flowchart Analysis:
stream index, such as-ast 3, which plays stream index 3
-vst Video_stream_specifier
Specifies the video stream index, such as-vst 4, which plays stream index 4
-sst Subtitle_stream_specifier
Specify a caption stream index, such as-sst 5, with a stream index of 5 subtitle stream
-autoexit
Exit after the video has finished playing.
-exito
=maxmatch (); Nx,ny to initialize!!! Time is complicated. O (v^0.5 E) suitable for large binary matches requires the queue header file ********************************************** */#include "CString"#include "Cstdio"#include "string.h"#include "iostream"#include "queue"using namespace STD;Const intmaxn=1510;Const intinf=1 -;intG[maxn][maxn],mx[maxn],my[maxn],nx,ny;intDx[maxn],dy[maxn],dis;BOOLVST[MAXN];BOOLSEARCHP () { Queueint>Q; Dis=inf;memset(dx,-1,sizeof(DX));memset(dy,-1,sizeof(DY)); for
) Traverse each point in the Q2, find all the previous trend of the point (need to first build a complement map), if the previous trend is not determined, it is added to the queue Q2;(5) in the (3) (4) step, one of the following occurs, the attempt fails, or the attempt succeeds:(6) If this attempt succeeds, then the state of all points in the Q1 will be changed to 1, the Q2 a bit of the state to 2, turn (2), or try to point I ', if still fail the problem has no solution.The algorithm has a time
understand.
This knowledge can be obtained through the Internet, books and teachers.
The last sentence is very important, is to see your focus is what, if the music typesetting mainly with Sibelius or finale.
If the computer to make music mainly, it is sonar, Logic, Pro Tools, Cubase, Nuendo and so on.
Music notation Creative Handwriting software is the world's leading music notation creative software. It has pioneered the simplification of the music notation computer input way, realized th
How to install CUBASE5 software?
1. Before installing CUBASE5, we should first make sure that there are no versions of Cubase software installed in the computer before, if any, delete them.
2, open "My Computer", click the tool Folder Options.
3, in the "View" Item, check the selected display hidden file, and remove the "Hide protected system files" before the tick.
4, open the C:programdatasyncrosoft directory, the file "Selicenser.sel" deleted.
5, then start to install C
() points to Nested_run_loop, Posttask will perform a quit operation on the nested runloop Messageloop::current ()->posttask (From_here, Nested_run_loop. Quitclosure ());//When Task_callback is executed asynchronously, the nested runloop is now exited, restored to the original message queue execution; Messageloop::current ()->posttask (from_ Here,task_callback);the message loop mechanism of the Android systemThe fundamentals of the message loop mechanism on the Android platform are very similar
Introduction :Handlerthread inherits thread, when the thread is turned on, that is, when it runs, the thread creates a looper that contains the message queue and provides its own get method for this Looper object. This is the only difference between it and the normal thread.Benefits :Why to use Handlerthread1, if the development of multiple uses like new Thread () {}.start (); In this way, a child thread is
Handler is primarily the main thread and sub-threading communication. In general, some time-consuming operations in a child thread are done to notify the main thread to modify the UI.In fact, the Android system in activity startup or state changes are implemented through the handler mechanism.First, enter into the main method of Activitythreadpublic static void Main (string[] args) { ... Looper.preparemainlooper (); Activitythread thread = new Activitythread (); Threa
");}SThreadLocal. set (new logoff ());}
Here, the local storage variable of the ThreadLocal thread is used to associate the logoff with the call thread.What is the message processing process?/*** Run the message queue in this thread. Be sure to call* {@ Link # quit ()} to end the loop.*/Public static final void loop (){Looper me = mylome (); // The Looper object stored in the threadMessageQueue queue = me.
Android Message Queuing model Thread,handler,looper,massage queueBoth the message queue and message loop for the Android system are for a specific thread, and a thread can exist (and, of course, not exist) a message queue and a message loop (Looper). In addition to the UI thread (the main thread) in Android, the worker threads created by default have no message loops and message queues. If you want the thre
, context); Threadpool.submit (request);//Submit task RequestHandle RequestHandle = new RequestHandle (request); This place is used to determine if there is a request before retrieving an unnecessary request object, because RequestHandle can cancel the task, using the weak object if (context! = NULL) {//ADD request T O Request Map ListConstructs a request to return an object, you can cancel the requestRequestHandle RequestHandle = new RequestHandle (request);The Resp
(runnestedloop,unretained (nested_run_loop))); /Once the Runnestedloop is running, the Runloop pointer inside Messageloop::current () points to Nested_run_loop, and Posttask runs the quit operation on the nested runloop Messageloop::current ()->posttask (From_here, Nested_run_loop. Quitclosure ());//When the Task_callback is run asynchronously, the nested runloop is now exited and resumed to the original message queue; Messageloop::current ()->posttask (from_ Here,task_callback);the message loo
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.