A界面中有viewpager的动态加载,从界面A跳到界面B,再finish掉B返回A时报出此异常。

java.lang.IllegalStateException: 
The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged!
Expected adapter item count: 0, found: 1 Pager id: com.##.##.android:id/vp_pager Pager class: class android.support.v4.view.ViewPager Problematic adapter: class com.##.contacts.quickcontact.Activity$ViewPagerAdapter
- ::21.060: E/com.##.##.##.Application(): at android.support.v4.view.ViewPager.populate(ViewPager.java:)
- ::21.060: E/com.##.##.##.Application(): at android.support.v4.view.ViewPager.populate(ViewPager.java:)
- ::21.060: E/com.##.##.##.Application(): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:)
- ::21.060: E/com.##.##.##.Application(): at android.view.View.measure(View.java:)
- ::21.060: E/com.##.##.##.Application(): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:)
- ::21.060: E/com.##.##.##.Application(): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:)
- ::21.060: E/com.##.##.##.Application(): at android.widget.LinearLayout.measureVertical(LinearLayout.java:)
- ::21.060: E/com.##.##.##.Application(): at android.widget.LinearLayout.onMeasure(LinearLayout.java:)

我的解决办法是

在界面A的onResume()方法中调用这个viewpager的adapter.notifyDataSetChanged()方法,这样就OK了

解决java.lang.IllegalStateException: The application’s PagerAdapter changed the adapter’s content的更多相关文章

  1. 解决java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext问题

    使用ClassPathXmlApplicationContext加载项目时, ClassPathXmlApplicationContext context = new ClassPathXmlAppl ...

  2. 【转】解决java.lang.IllegalStateException: The content of the adapter has changed but ListView...的问题

    原文网址:http://blog.csdn.net/ueryueryuery/article/details/20607845 我写了一个Dialog,Dialog中有一个ListView,想要点Li ...

  3. 解决java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext这个问题

    今天在运行别人的SSH项目时,遇到了这个问题 严重: Exception sending context initialized event to listener instance of class ...

  4. 开发问题及解决--java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout

    <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android=" ...

  5. The application’s PagerAdapter changed the adapter’s contents without calling PagerAdapter#notifyDa

    错误原因是在于修改了PageAdapter,却没有调用 PageAdapter的nodifyDataSetChanged方法.注意刷新数据 需要在主线程. 今天在做项目时出现了这个问题,一直报没有调用 ...

  6. Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/Cppcc] due to a StackOverflowError. Possible root causes include a too low setting for -Xs

    解决办法:(1)修改D:\Java\apache-tomcat-7.0.88\conf\catalina.properties (122line) (2)如org.apache.catalina.st ...

  7. java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [META-INF/services/com.alibaba.druid.filter.Filter].

    九月 11, 2019 2:56:36 下午 org.apache.catalina.loader.WebappClassLoaderBase checkStateForResourceLoading ...

  8. myeclipse 无法启动 java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).

    把myeclipse10 按照目录完整拷贝到了另外一台电脑, 另外的目录 原安装目录 D\:\soft\i\myeclipse10 新安装目录 E\:\soft\myeclipse10 双击启动失败, ...

  9. java.lang.IllegalStateException:Web app root system property already set to different value 错误原因及解决 Log4j

    Log4j是Apache的一个开放源代码项目,通过使用Log4j,我们可以控制日志信息输送的目的地是控制台.文件.GUI组件.甚至是套接口 服务器.NT的事件记录器.UNIX Syslog守护进程等: ...

随机推荐

  1. 如何改变git的默认路径

    1.win10下git默认启动路径是用户的根目录,东西太多太乱了. 2.修改很容易,右键单击桌面的快捷方式,选择“属性”. 3.删除“目录”中的 --cd-to-home 选项,再将“起始位置&quo ...

  2. 使用ASIHTTPRequest和ASIDownloadCache实现本地缓存

    源码:http://files.cnblogs.com/ios8/ASIHttpRequestDemo2.zip NSURL *url = [NSURLURLWithString:@"htt ...

  3. TensorFlow学习笔记(8)--网络模型的保存和读取【转】

    转自:http://blog.csdn.net/lwplwf/article/details/62419087 之前的笔记里实现了softmax回归分类.简单的含有一个隐层的神经网络.卷积神经网络等等 ...

  4. audio音乐播放

    1.audio标签 <audio @play="ready" @error="error" ref="audio" :src=&quo ...

  5. hive的join查询

    hive的join查询 语法 join_table: table_reference [INNER] JOIN table_factor [join_condition] | table_refere ...

  6. 【转】Java HotSpot(TM) 64-Bit Server VM warning: Insufficient space for shared memory file:

    使用命令:JPS #jps  报错了 $jps Java HotSpot(TM) Server VM warning: Insufficient space for shared memory fil ...

  7. PHP 常见header 状态

    转载:http://blog.csdn.net/mothz/article/details/6029810 <?php //200 正常状态 header('HTTP/1.1 200 OK'); ...

  8. xorm的sql builder

    最近在使用xorm,并使用了sql builder来构建sql查询没想到升级后原来可以使用的代码居然报错了. 0x00 代码 sql, args, _ := builder.Select(" ...

  9. 使用 WebSphere ILOG JRules 开发保险应用系统

    使用 WebSphere ILOG JRules 开发保险应用系统 概述 保险行业在国内是一个充分竞争的行业,竞争的加剧导致保险公司的业务管理等各项费用在增长.而保险公司业务支撑系统的先进性与灵活支撑 ...

  10. Android TabHost的使用 顶部选项卡

    用TabHost 来实现顶部选项卡,上代码:activity_main.xml <?xml version="1.0" encoding="utf-8"? ...