IllegalStateException with PagerAdapter

后端 未结 3 1672
说谎
说谎 2021-02-20 01:47

I am getting an IllegalStateException within this activity but not too sure what is going on. Here is the ViewPagerAdapter class in QuickContactActivity.

private         


        
3条回答
  •  眼角桃花
    2021-02-20 02:26

    It happened to me when I tried to override getCount() of page adapter

    During authorization, I show only one page. After end of authorization I change page count to 3. It falls for me if I do not call InvalidatePageAdapter() once

    @Override
    public int getCount() {
    
        if (mAuthorization_Status == AUTH_STATUS.AUTH_SUCCESS) {
    
            if (!isRefreshed) {
                isRefreshed = true;
                this.notifyDataSetChanged();
            }
    
            return NUM_PAGES;
    
        } else {
    
            return 1;
            //return NUM_PAGES;
    
        }
    
    } // END: getCount
    

提交回复
热议问题