title: Android setUserVisibleHint never gets called?
body: <p>I need to know when my fragment is visible, I was using setMenuVisibility but I now know it's not a good option. I'm trying to implement setUserVisibleHint on a FragmentStatePagerAdapter Fragment, however it never gets called.</p>
  
  <pre><code>import android.app.Fragment;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.Toast;
  
  
  public class Contacts extends Fragment {
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              View view = inflater.inflate(R.layout.fragment_screen_contacts, container, false);
              return view;
          }
  
  
      @Override
      public void setUserVisibleHint(boolean isVisibleToUser) {
          super.setUserVisibleHint(isVisibleToUser);
          Log.d("MyFragment", "This never shows up.");
          Toast.makeText(getActivity(), "Neither does this", Toast.LENGTH_LONG).show();
      }
  }
  </code></pre>
  
  <p>I'm running API level 19, and set a minimum API Level of 15 on my AndroidManifest. Is there anything else to do to get setUserVisibleHint, what am I doing wrong?</p>