androidfragmentandroid-4.0-ice-cream-sandwichhidden

Fragment onHiddenChanged not called


I recently added Fragments to my applications. For a new application i'll need to get notified as soon as my fragment is shown. So i can do some calculations as soon as my fragment is shown again.

My Fragment is used with a TabIndicator and it's only one FragmentClass which is used a few times.

Here's the normal standard override class:

@Override
public void onHiddenChanged(boolean hidden) {
    super.onHiddenChanged(hidden);
}

Solution

  • Still looking for an answer? onHiddenChanged doesn't get called the first time an fragment is shown. Only when it changes state.

    From the documentation:

    Called when the hidden state (as returned by isHidden()) of the fragment has changed. Fragments start out not hidden; this will be called whenever the fragment changes state from that.