How does PagerActivity load crimefragment


#1

So in the book you get rid of crimeactivity. I dont see how pageractivity knows how to load crimefragment. Since SingleFragmentActivity isnt used. Dont see how crimefragment is added to the fragment manager. Any help understanding this i would be very grateful.


#2

So in other words how does pager activity know to load crime fragment?


#3

In listing 11.4, the FragmentManager (fm) is passed to the FragmentStatePagerAdapter. Since fm isn’t used in the methods we are overriding, the magic happens in the other methods of FragmentStatePageAdapter. Part of the magic anyway. The rest of the magic is when we return a Fragment from getItem().


#4

Wow thanks… I looked though the code and re-read the chapter like 3 times. dont know how i missed “return CrimeFragment.newInstance”