Waiting for onProgressUpdate to finish

Put your problem here if it does not fit any of the other categories.

Waiting for onProgressUpdate to finish

Postby Quipeace » Fri May 28, 2010 9:21 pm

Hello all,

I'm working on a prime number generator, but I ran into a small cosmetic problem.

I'm using an asynctask to run the prime generator, which uses onProgressUpdate(...) to then add the result to a textview, however, the thread runs so fast that the textview can't keep up with the changes.

What I'm looking for is a way to wait for onProgressUpdate to finish all it's tasks and then continue the thread.

Thank you all very much for your help ;)
Quipeace
Quipeace
Developer
Developer
 
Posts: 27
Joined: Tue Feb 23, 2010 4:00 pm

Top

Re: Waiting for onProgressUpdate to finish

Postby Quipeace » Sat May 29, 2010 7:08 am

Yes, I know about thread sleep, I'm using that to let the user set a pause after each prime, but I'm looking for something dynamic as I don't know what slower/faster phones will do, and I obviously want it as fast as possible.
Could I have onprogressreport return a variable I can wait for?

EDIT: Somewhat solved my problem, I'm now only refreshing the textview after 2000 primes (by default), as that's also increasing the performance.
Quipeace
Developer
Developer
 
Posts: 27
Joined: Tue Feb 23, 2010 4:00 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 13 guests