Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.catherine.forrealm.about_utils.RealmHelper.findAllStudent()' on a null object reference
报错:

解决方法:
private RealmHelper realm_search = new RealmHelper();
进而发现在写RecyclerView时,遗漏如下代码:
recy_search.setHasFixedSize(true);
recy_search.setNestedScrollingEnabled(true);
recy_search.setLayoutManager(new GridLayoutManager(SearchActivity.this,1));
将其补充至我的刷新UI中。
继而报错:

报错原因:
SearchAdapter报空!!我在刷新UI前就开始使用SearchAdapter,故会报空!!



解决方法,将两个方法顺序对调即可,如图:

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.catherine.forrealm.about_utils.RealmHelper.findAllStudent()' on a null object reference的更多相关文章
- java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.yunweather.app.db.YunWeatherDB.loadProvinces()' on a null object reference
NullPointerException:查看自己的什么地方是否对空指针进行了操作 Attempt to invoke virtual method 'java.util.List com.yunwe ...
- Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setDisplayShowHomeEnabled(boolean)' on a null object reference
/********************************************************************************* * Caused by: java ...
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.love5/com.example.love5.Main11Activity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.
若有 java.lang.RuntimeException和 java.lang.NullPointerException: Attempt to invoke virtual method 'voi ...
- java.lang.NullPointerException: Attempt to invoke virtual method 'int com.example.xxx.Json.NewsBean.getError_code()' on a null object reference错误解决
AS在运行的过程中出现了错误: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.example.xx ...
- java.lang.NullPointerException: Attempt to invoke virtual method 'void 、Handler.removeMessages(int)' on a null object reference
onDestory进行释放Handler时,需要判断null if(null != mHandler) { mHandler.removeMessages(MSG_CHANGE ...
- 【零碎小bug系列】安卓开发是遇到空指针异常java.lang.NullPointerException: Attempt to invoke...
安卓开发是遇到空指针异常 java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable ...
- Error: java.lang.NullPointerException at outputformat.MysqlOutputFormat.getRecordWriter(MysqlOutputFormat.java:27)
Error: java.lang.NullPointerException at outputformat.MysqlOutputFormat.getRecordWriter(MysqlOutputF ...
- 报错android.view.InflateException: Binary XML file line #11: Attempt to invoke virtual method 'boolean
出现这种问题,打开Android monitor的调试信息发现是 android.view.InflateException: Binary XML file line #11: Attempt to ...
- Attempt to invoke virtual method 'void android.app.ActionBar.setTitle的解决方法
在安卓4.4.2的关于蓝牙开发的一个sample BluetoothChat中,调试时,老是出错:Attempt to invoke virtual method 'void android.app. ...
随机推荐
- js 判断传入参数是域名还是地址
var get = function(url) { if(location.protocol === "http") { return url; } var reg = /^(ht ...
- Java Web(1)-JavaScript
一.JavaScript 和 html 代码的结合方式 1. 第一种方式 只需要在 head 标签中,或者在 body 标签中, 使用 script 标签 来书写 JavaScript 代码 < ...
- python3的字符串常用方法
find()# 方法 find()# 范围查找子串,返回索引值,找不到返回-1 # 语法 s.find(substring, start=0, end=len(string)) # 参数 # subs ...
- JVM系列之:String.intern和stringTable
目录 简介 intern简介 intern和字符串字面量常量 分析intern返回的String对象 分析实际的问题 G1中的去重功能 总结 简介 StringTable是什么?它和String.in ...
- Python os.chflags() 方法
概述 os.chflags() 方法用于设置路径的标记为数字标记.多个标记可以使用 OR 来组合起来.高佣联盟 www.cgewang.com 只支持在 Unix 下使用. 语法 chflags()方 ...
- PHP timezone_abbreviations_list() 函数
------------恢复内容开始------------ 实例 输出 "act" 时区的夏令时.偏移量和时区名称: <?php$tzlist=timezone_abbre ...
- 4.9 省选模拟赛 圆圈游戏 树形dp set优化建图
由于圆不存在相交的关系 所以包容关系形成了树的形态 其实是一个森林 不过加一个0点 就变成了树. 考虑对于每个圆都求出最近的包容它的点 即他的父亲.然后树形dp即可.暴力建图n^2. const in ...
- 从SpringBoot源码分析 配置文件的加载原理和优先级
本文从SpringBoot源码分析 配置文件的加载原理和配置文件的优先级 跟入源码之前,先提一个问题: SpringBoot 既可以加载指定目录下的配置文件获取配置项,也可以通过启动参数( ...
- 面试官:怎么做JDK8的内存调优?
面试官:怎么做JDK8的内存调优? 看着面试官真诚的眼神,心中暗想看起来年纪轻轻却提出如此直击灵魂的问题.擦了擦额头上汗,我稍微调整了一下紧张的情绪,对面试官说: 在内存调优之前,需要先了解JDK8的 ...
- 授人以渔:stm32资料查询技巧
摘要:本章以stm32f103作为案例向大家讲解arm公司和st公司的关系以及我们在对stm32开发时需要如何正确的查找手册. ARM公司和ST公司的关系 这里要从一块芯片的生产说起,比如我们要生成一 ...