title: ViewPager changed position checkBox event again active
body: <p>I have very simple question . I used View Pager with FragmentStatePagerAdapter in my app.</p>
  
  <p><strong><em>View Pager Tabs position respectively  : Game|Movie|Study</em></strong></p>
  
  <p>I used checkbox in StudyFragment. First , I checked checkbox in Study Tab and changed tab position(for example Game Tab ). Then I re-click Study Tab check box's  OnCheckedListener event was active and toast message again appeared. My PagerAdapter code shown as below :</p>
  
  <pre><code>public class PagerAdapter  extends FragmentStatePagerAdapter{
      public PagerAdapter(FragmentManager fm) {
          super(fm);
      }
  
      @Override
      public Fragment getItem(int position) {
  
          Fragment frag=null;
          switch (position){
              case 0:
                  frag=new GameFragment();
                  Log.i("PagerAdapter","pos0");
                  break;
              case 1:
                  frag=new MovieFragment();
                  Log.i("PagerAdapter","pos1");
  
                  break;
              case 2:
                  frag=new StudyFragment();
                  Log.i("PagerAdapter","pos2");
  
                  break;
          }
          return frag;
      }
  
  
  
      @Override
      public int getCount() {
          return 3;
      }
  
      @Override
      public CharSequence getPageTitle(int position) {
          String title=" ";
          switch (position){
              case 0:
                  title="Game";
                  break;
              case 1:
                  title="Movie";
                  break;
              case 2:
                  title="Study";
                  break;
          }
  
          return title;
      }
  }
  </code></pre>
  
  <p>Study Fragment code as below  : </p>
  
  <pre><code>public class StudyFragment extends Fragment {
  
  CheckBox checkBox;
      public StudyFragment() {
          // Required empty public constructor
      }
  
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          View v=inflater.inflate(R.layout.fragment_study, container, false);
          checkBox=(CheckBox)v.findViewById(R.id.checkBox);
  
          checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                  if(isChecked) {
                      Toast.makeText(getActivity(), "checked", Toast.LENGTH_SHORT).show();
                  }
                  else
                      Toast.makeText(getActivity(), "not checked", Toast.LENGTH_SHORT).show();
              }
          });
          return v;
      }
  
  
  }
  </code></pre>
  
  <p>I don't want that toast message again shown when changed tab. So I don't want triggered checkBox isChecked decision when re-changed tab How to fix it ? </p>
  
  <p><em>I fixed problem for me. When I changed tab I destroy previously fragment. 
  add this line ViewPagerAdapter</em></p>
  
  <pre><code>@Override
      public void destroyItem(ViewGroup container, int position, Object object) {
              FragmentManager manager = ((Fragment) object).getFragmentManager();
              FragmentTransaction trans = manager.beginTransaction();
              trans.remove((Fragment) object);
              trans.commit();
  
      } 
  </code></pre>