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. MySQL,如何修改root帐户密码、如何解决root帐户忘记密码的问题

    1. 如何修改root帐户密码 打开MySQL 5.6 Command Line Client窗口,输入当前密码登录,然后依次输入如下3条命令: use mysql; update user set ...

  2. Java Web(八) MVC和三层架构

    今天终于认识到自己的渺小,想起了一句话,不努力机会来了你也抓不住,不要一直想一步登天,一直沉浸在白日梦的美好之中,一步一个脚印,有多大能力做多大的事情,走程序员的这条路,那么我就想去好公司,一切都以进 ...

  3. 菜鸟学SSH(十三)——Spring容器IOC解析及简单实现

    最近一段时间,“容器”两个字一直萦绕在我的耳边,甚至是吃饭.睡觉的时候都在我脑子里蹦来蹦去的.随着这些天一次次的交流.讨论,对于容器的理解也逐渐加深.理论上的东西终归要落实到实践,今天就借助Sprin ...

  4. Java 必须掌握的 12 种 Spring 常用注解!

    1.声明bean的注解 @Component 组件,没有明确的角色 @Service 在业务逻辑层使用(service层) @Repository 在数据访问层使用(dao层) @Controller ...

  5. Splunk Web页面的登录密码忘记了怎么办

    splunk的web登录密码忘记的话,可以使用以下方法重置. 一.关闭splunk服务 /opt/splunk/bin/splunk stop 二.删除默认密码配置文件 三.重启启动splunk服务, ...

  6. webpack的代码分割/离

    两种方法: 1.webpack的methods----require.ensure 2.ES 2015的Loader spec //require.ensure语法 require.ensure [] ...

  7. QQ通信原理及QQ是怎么穿透内网进行通信的?

    http://blog.csdn.net/frank_good/article/details/51160027 ******************************************* ...

  8. How to disable SSL certificate checking with Spring RestTemplate?(使用resttemplate访问https时禁用证书检查)

    How to disable SSL certificate checking with Spring RestTemplate?(使用resttemplate访问https时禁用证书检查) **** ...

  9. 连接池(Connection Pool)技术

    解释: 连接池(Connection Pool)技术的核心思想是:连接复用,通过建立一个数据库连接池以及一套连接使用.分配.管理策略,使得该连接池中的连接可以得到高效.安全的复用,避免了数据库连接频繁 ...

  10. 基于jQuery垂直多级导航菜单代码

    基于jQuery垂直多级导航菜单代码是一款黑色风格的jQuery竖直导航菜单特效下载.效果图如下: 在线预览   源码下载 实现的代码. html代码: <ul class="ce&q ...