RunOnUIThread question

I am creating a download manager with listview and it will display the current value loaded using the progress bar. Can I find out how I can update the progress bar?

eg. I have 3 classes.

"main.class" = is a list.

"mAdapter.class" = extends ArrayAdapter.

"mThread.class" = implements Runnable to start the download.

I have google and a list update is found, or redrawing the user interface should use runOnUIThread . but how can I combine these 3 classes together? I tried

 mThread.start(){ main.runOnUIThread(updated); } private updated = new Runnable(){ mAdapter.progressbar.setProgress(downloaded); } 

this 2nd method was placed in "mThread.class". but that will not work. May I know that I was a delusion?

P / S: Sorry for my ugly code and bad English. I hope you guys understand what I'm talking about. thanks

+2
source share
1 answer

You need to use AsyncTask. See documents for descriptions and examples.

+1
source

All Articles