解决viewpager adpter.notifyDataSetChanged不刷新问题

解决方法:

class MyAdapter extends PagerAdapter {
            //定义一个全局变量
     private int mChildCount = 0;

     @Override
     public void notifyDataSetChanged() {    
           //重写notifyDataSetChanged方法
           mChildCount = getCount();
           super.notifyDataSetChanged();
     }

     //重写getItemPosition方法
     @Override
     public int getItemPosition(Object object)   {          
           if ( mChildCount > 0) {
           mChildCount --;
           return POSITION_NONE;//返回POSITION_NONE
           }
           return super.getItemPosition(object);
     }

}

原因:
Android viewPage notifyDataSetChanged无刷新 - maoyu417 - 博客园
http://www.cnblogs.com/maoyu417/p/3740209.html

你可能感兴趣的:(android学习笔记)