I wouldn't count on ever being called when your app is as busy as it
is. Instead, I would make sure that there was only one instance of your specific Runnable on the queue. Set a flag when you create and queue the Runnable and have the Runnable clear the flag when it completes, and don't create the Runnable again if the flag is set. Al wrote: Michael, I had a look at http://code.google.com/android/reference/android/os/MessageQueue.IdleHandler.html, which is supposed to be called when the message queue is empty, but I never received a call on it. I'm implementing it like this:myHandler = new Handler() { MessageQueue.IdleHandler foo = new MessageQueue.IdleHandler() { public boolean queueIdle() { //Do something return true; } }; public void handleMessage(Message m) { //Handle the message } }; Am I implementing it right? @RomainGuy, just using post didn't help, but I think using post() would be better to use if I was able to check the status of the message queue (empty or not). On Jan 13, 2:59 am, Michael MacDonald <googlec...@antlersoft.com> wrote:Try not posting a runnable on the receiving thread if one is already queued? Al wrote:Hi all, in my irc app, I'm trying to improve the responsiveness when it has to deal with a lot of data at a single time.At the moment, once the data is append()-ed to the textview, I post a delayed runnable (100ms delay) back to the UI thread to make it scroll right down to the bottom. Unfortunately, without the runnable being posted, it doesn't seem to be possible to correctly calculate the amount the ScrollView should scroll and often scrolls halfway only.This works fine for normal situations and the program is fully responsive. But when, there is a lot of channel activity, the queue of Runnables start to strain the UI thread and it has trouble appending the data as it arrives and occasionally causes an ANR.My question is, how would I get around this? Without the Runnable, it doesn't scroll correctly but with it, it causes problems. A possible solution could be to detect when there is an influx of data and post the Runnable less often, but I'm not sure how I would detect this.Any ideas welcomed. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~--- |
- [android-developers] Large amounts of data and app respo... Al
- [android-developers] Re: Large amounts of data and ... Romain Guy
- [android-developers] Re: Large amounts of data and ... Michael MacDonald
- [android-developers] Re: Large amounts of data ... Al
- [android-developers] Re: Large amounts of d... Michael MacDonald