Can anyone tell me how to use If you are using handler, then I believe that something in you To use different threads and headlars, you are using thread to start and main threads B / D to communicate. Take the following example: The credit goes to both of these threads: It can be a good read: & amp; Hope it helps switch
what
handler uiHandler = new handler () {public zero handling message (message message) {switch (msg.what) {}}};
Personal Static FINAL SUCCESS SUCCESS = 0; Private Stable Finals FA FAIL = 1; // This Handler Handler uiHandler = New Handler () {@Override Public Zero StableMessage (Message msg) {// Here you use Switch Statement Switch (msg.) {Case Success: // Some Break; The case failed: // something broke; }}}; // This is an example of how you can call it threads t = new thread () {@Override public void run () {doSomeWork (); If (successful) {/ we can not update UI from here, then we will signal our handler and will do it for us. * / // 'sendEmptyMessage' only sends a message containing 'only' value. UiHandler.sendEmptyMessage (success); } And {uiHandler.sendEmptyMessage (FAIL); }}}
No comments:
Post a Comment