[Java]View Plaincopy
- This.runonuithread (new Runnable () {
- @Override
- public Void Run () {
- try {
- Thread.Sleep (+ 5);
- } catch (Interruptedexception e) {
- E.printstacktrace ();
- }
- Inputmethodutils.show (context, editText);
- System.out.println ("xx");
- }
- });
- System.out.println ("xxxxxx");
In OnCreate, perform the change method. Execution results are as follows
Xx
xxxxxxx
It should also be understood that the system has only one (unique) independent main thread--uithread, all related to the interface is synchronous execution
[Java]View Plaincopy
- new Handler (). Post (new Runnable () {
- @Override
- public Void Run () {
- try {
- Thread.Sleep (+ 5);
- } catch (Interruptedexception e) {
- E.printstacktrace ();
- }
- Inputmethodutils.show (context, editText);
- System.out.println ("xx");
- }
- });
- System.out.println ("xxxxxx");
In OnCreate, perform the change method. Execution results are as follows
xxxxxxx
Xx
End the OnCreate then the thread in the handler continues to execute
[Turn]runonuithread, Handler contrast (i)