Thanks for the replies. I should clarify some of the points you both mentioned. This server is not in my control at all, so any kind of push would be out of the question I suppose. I only want to pull in short increments if the user is actively using the Activity in question, not if the phone is locked, or they're in another app, or even in my app but in another Activity.
I know I could refresh the init method I have which kicks off the thread to pull new data but given the ProgressDialog it shows, I think it would be annoying to see that so frequently when the user isn't actively requesting it. If I use the small loading icon, I suspect since the UI and data pull are running on different threads it wouldn't lock up the UI on the end user but I'll need to test that for performance/responsiveness. Maybe I'll give that a shot and see how it goes. Long term, I would like to do this in longer intervals (30+ minutes) when the user is not actively in the app or on this Activity and toss up a notification if something interesting happens with the new data. While also retaining the 5-10 second interval when they are actively looking at this Activity. Long term... :) -- Chris Stewart http://chriswstewart.com On Fri, Mar 4, 2011 at 4:22 AM, Kostya Vasilyev <kmans...@gmail.com> wrote: > It just depends on what kind of server you're dealing with. > > If it's your own, you could implement a simple push scheme by keeping the > TCP/IP connection open after the initial data download, and having the > server send new data over this connection. The client would just check every > few seconds if the socket has readable data, and if so, read it and update > the UI. A variation of this would use two connections, one for > notifications, and one for data. > > As far as the UI goes - first, you could display the standard progress > wheel in the activity's title bar, second, you could add a special footer to > your list view that says "Loading..." and is then pushed out of sight by the > new data item. > > -- Kostya > > 04.03.2011 7:14, Chris Stewart пишет: > >> I have a service I'm pulling data from and they suggest doing so every >> 5-10 seconds it's designed to be a near-real-time experience. I'm currently >> pulling this information down and displaying it in a ListView. During the >> initial load, I toss up a basic ProgressDialog so the user knows information >> is being loaded. However, introducing that automatically in such a short >> increment of time would be an annoying user experience. >> >> Is there a nice way to approach this problem in Android? I'd like to be >> able to run an update on the data I'm pulling from the web without >> disrupting the end user's experience. Ideally, not even disrupting them if >> they happen to be scrolling the view. The data itself will always be >> additions to data that's already been pulled down, so essentially I'm adding >> records to my Adapter every 5-10 seconds. >> >> -- >> Chris Stewart >> http://chriswstewart.com >> >> -- >> 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 >> > > > -- > Kostya Vasilyev -- http://kmansoft.wordpress.com > > > -- > 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 > -- 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