On Jan 21, 7:45 am, Mark Murphy <[email protected]> wrote: > Nmix wrote: > > In a TabActivity I have a tab with a ListView. I manage the > > visibility of a View for when the list is empty, done after filling > > the list, whenever I know the backing data changes. > > > When the list is empty (empty View is visible) and the activity is > > paused, and while paused the backing SQLlite table gets filled, when > > my activity resumes the ListView gets filled with the new database > > rows (managed cursor requery?) but I haven't had the chance to set the > > visibility of the empty View, so it's still there. > > > I can figure out how to do this with some persistent data from pause > > to resume, but I'm wondering if there's a 'cleaner' and automatic way > > of achieving this in Android. Thanks. > > If the trigger for making your View be visible is the existence of data, > perhaps notify-on-change support is what you want. I haven't played with > this much myself. > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > Android Training in Sweden --http://www.sotrium.com/training.php
I kept it simple for now and refilled the ListView at onResume, so I avoid having to expose the cursor or other data more globally than I already do. It's somewhat redundant but it works since the visibility logic is inside the method that does the filling. An example that's very similar is Android's Call Log. If it's empty and you make a call, then go back to the log and switch tabs from the dialer to the log, it displays as expected (suppressing the 'empty' View). Maybe they refill whenever the tab is selected. I avoid this since it would be redundant if the data is the same. The difference between my app and the Call Log is that no change of tab is involved. Your suggestion may be better but in the interest of time I will move on with what works. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

