private void checkAdapter ( ) { PagerAdapter adapter = mPager . getAdapter ( ) ; if ( mAdapter != adapter ) { if ( mAdapter != null ) { mAdapter . unregisterDataSetObserver ( mObserver ) ; } mAdapter = adapter ; if ( mAdapter != null ) { mAdapter . registerDataSetObserver ( mObserver ) ; } reset ( ) ; } }
Check if the pager has a new adapter and switch to it if it does .