Android Button Response Problem -


hi since using button , on click of button connects web service. problem when press button not showed me has been clicked , goes connect internet , web service. after connecting shows me response has been clicked. in short response of button slow. if buton has internet connectvity in listener. know has ui thread. please friends guide me through this.

thanks bunch,

put following code in class:

 // need handler callbacks ui threads     // background operations     final handler mhandler = new handler();      // create runnable posting results     final runnable mupdateresults = new runnable() {         public void run() {             // task needs done after webservice call complete.         }     }; 

and calling webservice use following code in button event:

new thread() {             public void run() {                              // place webservice call here.                     mhandler.post(mupdateresults);             }             }.start(); 

actually looking multithreading, webservice calls , network activities should go in separate thread. after thread start() call can ever want , done instantly without delay (in case showing button pressed).


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -