title: Using Android Paging Library to display filtered results from same 2 loaded fragments in ViewPager with FragmentPagerAdapter
body: <p>I have a single activity app which is centered around a fragment that will list data from online API. I use the same fragment throughout the app filtering the data as needed.</p>
  
  <p>Filtering is done by having parameters passed through the Factory to the DataSource. All this works fine if I only have one fragment loaded. I can filter and search just fine.</p>
  
  <p>Problems start when trying to load multiple fragments in a ViewPager. For example Fragment A - is filtered to show active items 
  Fragment B - is filtered to show expired items both are to be displayed in a ViewPager using FragmentPagerAdapter. When I run the app both Fragments get filted for expired items (the last fragment added to viewpager) It seems the parameters that Fragment A set in the DataSource are overwritten immediately by Fragment B. Fragment A loadInitial works as it should but loadAfter is using the parameters  from Fragment B.</p>
  
  <p>should also note if I invalidate() the DataSource it returns the correct filtered data without issue. (so its just when loaded my params get overwritten and loadAfter uses incorrect param)</p>
  
  <p>Tried messing with the Observer using getViewLifecycleOwner() trying to figure if they way I am calling the DataSource is the issue, Tried the various ViewPager Adapters FragmentStatePagerAdapter and FragmentPagerAdapter. </p>
  
  <p>All the checks show the DataSource getting the correct parameter then show it getting overwritten almost immediately.</p>
  
  <p>So question is the call to PageKeyedDataSource not unique to the Fragment Calling it? Why are my variables being overwritten by another fragment.</p>
  
  <p>Can anyone say where I should be looking to resolve this issue.</p>
  
  <p>Side note I have three fragments loaded using FragmentStatePagerAdapter with 2 of 3 being the Same Fragment Called with different params.
  It works fine because with three fragments loaded the FragmentStatePagerAdapter apparently doesnt initialize the 3rd fragment until after everything is loaded so it does not trip over the other fragment.</p>