I have a ListFragment. In onCreateView I inflate a view that has a ListView with Id android:List and a TextView with Id android:empty.
I'd like a progress indicator on my Fragment view until the list has been loaded with data from an asyncCall. To do this it looks like I should setListShown(false) onActivityCreated (or in the AsyncTask onpreExec or onprogUpdate or something).
Then onStart of Fragment I'd say setListShown(true) in order to display the list and remove the progress.
But when I try to use setListShown I get IllegalStateException("Can't be used with a custom content view");
What exactly do they mean by custom list view? Is it a Custom List view simply by overriding onCreateView? even though I have a listView in the view with Id android:List which is expected by ListFragment....
you can try using a view switcher in each of your fragments. the concept here is one layout has two views that you can cycle or page through.
one view in the switcher, page 1 if you will, would have a loading progress and the other view, page 2, would have the list. you default to page 1, or the progress loader view.
once you determine your list is loaded and rendered, switch the view, switcher.showNext() to display the list.
switcher.showNext() or switcher.showPrevious() will take you back to the loader.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With