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. 不存数据库生成验证码(totp算法)

    以前做验证式的方法都是new Random().Next(10000,99999) 生成随机数了以后存到数据库中的用户表中,用户输入验证码了再查询用户表做比较的,网友说这种做法太LOW B了,应该用T ...

  2. Atitti dbutil获取多个返回结果集的解决

    Atitti dbutil获取多个返回结果集的解决 1.1. 多个select默认只返回第一个resultset1 1.2. 调用存储过程,也是返回第一个select的1 1.3. 如果insert前 ...

  3. 【Unity】12.1 基本概念

    开发环境:Win10.Unity5.3.4.C#.VS2015 创建日期:2016-05-09 一.简介 导航网格(Navmesh)是世界坐标系中几何体的简化表示,被游戏代理用来进行全局导航.通常,代 ...

  4. 字符串匹配算法KMP算法

    数据结构中讲到关于字符串匹配算法时,提到朴素匹配算法,和KMP匹配算法. 朴素匹配算法就是简单的一个一个匹配字符,如果遇到不匹配字符那么就在源字符串中迭代下一个位置一个一个的匹配,这样计算起来会有很多 ...

  5. 菜鸟学SSH(十六)——Struts2内部是如何工作的

    前面说完了Spring.Hibernate,很自然今天轮到struts了.struts的核心原理就是通过拦截器来处理客户端的请求,经过拦截器一系列的处理后,再交给Action.下面先看看struts官 ...

  6. 将redis作为windows服务安装

    1,下载redis并解压到一个目录下,然后切换到该目录下,也就是redis-server.exe文件所在的目录 2,在cmd下执行 redis-server --service-install red ...

  7. MySQL开发索引创建规范

    1. [强制]业务上具有唯一特性的字段,即使是多个字段的组合,也必须建成唯一索引. 说明:不要以为唯一索引影响了insert速度,这个速度损耗可以忽略,但提高查找速度是明显的:另外,即使在应用层做了非 ...

  8. 【内核】探究linux内核,超详细解析子系统

    Perface 前面已经写过一篇<嵌入式linux内核的五个子系统>,概括性比较强,也比较简略,现在对其进行补充说明. 仅留此笔记,待日后查看及补充! Linux内核的子系统 内核是操作系 ...

  9. 在IIS服务器上屏蔽IP的访问

    今天就跟大家分享一下在IIS服务器上如何屏蔽特定IP的访问,希望对大家有所帮助. 第一种方法:通过iis中的ip地址和域名限制. 此方法简单有效,建议使用 点击网站--右键属性--目录安全性--IP地 ...

  10. hive sequencefile导入文件遇到FAILED: SemanticException Unable to load data to destination table. Error: The file that you are trying to load does not match the file format of the destination table.错误

    hive sequencefile导入文件遇到FAILED: SemanticException Unable to load data to destination table. Error: Th ...