Monday, May 30, 2011

Run On UIThread in Android

To push the piece of code running in a thread to main UI thread ,

MyActivityObject.runOnUiThread(new Runnable() {
       
 @Override
        public void run() {
                //code out here
        }
  });
 
One of the usecase will be, modify an UI element's  data from doinbackground() 
method of Asynctask.

No comments:

Post a Comment