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. 用Power BI观察经济与健康的关系

    Hans Rosling是卡罗琳学院的国际卫生学教授.这位学者与众不同的技能是数据可视化.以直观的数据展现了令人信服的世界观,而且在gapminder.org提供无偿展示以及下载.假设你没有看过下面的 ...

  2. Atitit mysql存储过程编写指南

    Atitit mysql存储过程编写指南 1.1. 设定参数与返回值  `obj_id` int ,,返回类型 varchar(200)1 1.2. 在语句中使用传入的obj_id参数1 1.3. 测 ...

  3. PostgreSQL判断是否为空coalesce

    coalesce(expr1,expr2,expr3...) 直到找到一个非null值返回,右边的表达式则不参与运算:若所有为null,返回null. eg:判断json是否包含某属性,若无,则取默认 ...

  4. Vuex 实践讲解

    state 用来数据共享数据存储 mutation 用来注册改变数据状态 getters 用来对共享数据进行过滤操作 action 解决异步改变共享数据 这个四大特征就是核心,如何用怎么用 接下来还是 ...

  5. 通过ip查找能应机器的MAC

    例如:10.100.0.61 这些都是基于linux系统: 首先:ping 一下这个ip 然后arp 10.100.0.61就可以找出主机的MAC地址

  6. kernel dump Analysis

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/0c418482-7edd-4c91-b7f4-6005d550244a/got-the- ...

  7. Tornado使用-队列Queue

    1.tornado队列的特点 和python标准队列queue相比,tornado的队列Queue支持异步 2.Queue常用方法 Queue.get() 会暂停,直到queue中有元素 Queue. ...

  8. DIOCP开源项目-高效稳定的服务端解决方案(DIOCP + 无锁队列 + ZeroMQ + QWorkers) 出炉了

    [概述] 自从上次发布了[DIOCP开源项目-利用队列+0MQ+多进程逻辑处理,搭建稳定,高效,分布式的服务端]文章后,得到了很多朋友的支持和肯定.这加大了我的开发动力,经过几个晚上的熬夜,终于在昨天 ...

  9. vs code 快捷键的使用

    vs code 快捷键的使用 shift + f12 快速查找函数的生成Ctrl+F12 查看单个函数的定义Shift+F12 查看所有函数的定义ctrl + ` 是打开运行的程序ctrl + Tab ...

  10. 邮箱登录form表单样例

    index.html <!doctype html> <html lang="en"> <head> <meta charset=&quo ...