Skip to content Skip to sidebar Skip to footer

Handling Ui From Other Thread

I have a class which extends the Runnable. This class performs some heavy operation (basically downloads the image from network) in different thread. I want to update the UI (displ

Solution 1:

You could use AsyncTask instead, do what you're currently doing in run() in doInBackground, and then do the UI update in the task's onPostExecute.

Solution 2:

almost ;D you need on the class thread add the that linebefore while do:

while(true)
    {
      //do image download process here
    }
uiHandle.sendEmptyMessage(0);

Solution 3:

To update the UI from another thread use

activity.runOnUIThread(newRunnable());

Post a Comment for "Handling Ui From Other Thread"