If @commonsware doesn't mind, I'll put this into an answer for prosperity. Although I'm sure if he has any further insights, he will create a much better answer.
I had the feeling you could be dealing with multiple copies of your QslLogFragment
. I have faced similar problems previously.
In situations like this, it is a good idea to log your method calls, like you have done. Where it is "impossible" for the adapter to be different, that is the hint of having 2 fragments, hence the suggestion to log the fragment as well.
Place extra logs in ALL the Activity & Fragment lifecycle methods to track down the final piece of the puzzle. It may seem like overkill, but you could find some surprises.
In the case that I had, which you reminded me of, I had based my code on an Android SDK sample that actually created a new fragment each time I tried to access it. I had not cached any of the fragments that were previously created. So check the code that retrieves (or creates) your fragment.
Here is the code from my FragmentPagerAdapter
that creates a new fragment each time. This is bad code, and I don't recommend it, but for now it serves its purpose in the demo it comes from.
public Fragment getItem(int position)
{
// TODO don't create a new fragment each time this is called
switch (position)
{
case 0:
{
return new WindFragment();
}
// more cases... etc...
default:
{
return new TemperatureFragment();
}
}
}
This is called every time the user flips to a new page, to show a different fragment. This code caused an issue very similar to yours.