After going through the whole book I have been working on an app that is heavy on listviews and I am extending ListFragment similar to what is happening in CrimeListFragment in this chapter.
I need to do some work on the fragment view in onCreateView within the ListFragment and am having some serious difficulty resolving the issue of where I need to put within my layout a ListView with the android:id attribute set to @android:id/list.
I keep getting faults and have found numerous references telling me to do this but I am just being a moron and not getting where and in which layout file it needs to go, and what I need to do additionally inflation-wise etc. The idea is to be able to findViewbyId to get the ListView in onCreateView.
Where do I need to put this?
I have noticed that in every example in the book that uses a ListFragment, there is no onCreateView method whatsoever in the extended ListFragment class (like CrimeListFragment) and this magic id is not around either.
Like this example my activity_fragment.xml file is:
This is inflated just like this chapter in the SingleActivityFragment abstract class in the onCreate method.
My list_item_xxx.xml layout used for my custom item layout is a relative layout similar to list_item_crime.xml in this chapter.
Maybe I am confused as to the use of these layouts. I thought the list_item_crime layout is used when there is no view inflated in getView of the custom adapter, and that activity_fragment is inflated in singlefragmentactivity when the fragmentactivity (the fragment? or the activity?) is getting kicked off.
So where in which xml file should I put the ListView business so that I can access it in onCreateView? SHould I create an additional file with just the listview in it and only use that when inflating the ListView and accessing it in onCreateView?
Sorry for the convoluted question but this is driving me nuts. For now I simply removed onCreateView and am living without it in my listfragmentactivity but would like to use it.