My current project uses ListFragments to display rows of data. Lines are updated dynamically every few seconds. The number of rows depends on each update and each ListFragment .
I would like to show the row count for the user and think that the ideal place for this would be next to the Fragment heading in the ViewPagerIndicator. I presented a sample image for a better understanding:

Unfortunately, I donβt quite know how to achieve this. I tried the following:
public class PagerAdapter extends FragmentPagerAdapter { private int numOne = 0; private int numTwo = 0; // ... @Override public CharSequence getPageTitle(int position) { switch (position) { case 0: return "List 1 (" + numOne + ")"; case 1: return "List 2 (" + numTwo + ")"; default: return ""; } public void setNumOne(int num) { this.numOne = num; } public void setNumTwo(int num) { this.numTwo = num; } }
When I now call the setNumXXX() method, nothing happens until I go between the fragments, which seems to cause getPageTitle() fire.
My question is: how can I force the header (s) to be updated every time the num value changes?
source share