在安卓4.4.2的关于蓝牙开发的一个sample BluetoothChat中,调试时,老是出错:Attempt to invoke virtual method 'void android.app.ActionBar.setTitle

上网查了一下,是这么说的:

(http://www.tuicool.com/articles/IRzUR3M)

The LayoutManager is probably
the most interesting part of theRecyclerView .
This class is responsible for layouting all child views. There isone default implementation available: LinearLayoutManager which
you can use for vertical as well as horizontal lists.

You have to set a LayoutManager for
your RecyclerView otherwise
you will see an exception at Runtime:

所以我就把源代码中的:

private final void setStatus(int resId)

private final void setStatus(CharSequence subTitle)

这两个方法注释掉,就可以正常运行了。

Attempt to invoke virtual method 'void android.app.ActionBar.setTitle的解决方法的更多相关文章

  1. Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setDisplayShowHomeEnabled(boolean)' on a null object reference

    /********************************************************************************* * Caused by: java ...

  2. 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 ...

  3. 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 ...

  4. 报错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 ...

  5. 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 ...

  6. 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 ...

  7. 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_sea ...

  8. Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null objec

    遇到这个一场折腾了1个小时, 这是系统在解析XML的时候出错, 最后费了好大的劲才发现 XML文件中,<View>  写成小写的 <view> 了. 崩溃啊.......... ...

  9. Attempt to invoke interface method 'boolean java.util.List.add(java.lang.Object)' on a null

    1.Android Studio报错 Attempt to invoke interface method 'boolean java.util.List.add(java.lang.Object)' ...

随机推荐

  1. Python虚拟机之异常控制流(五)

    Python中的异常控制语义结构 在Python虚拟机之异常控制流(四)这一章中,我们考察了Python的异常在虚拟机中的级别上是什么东西,抛出异常这个动作在虚拟机的级别上对应的行为,最后,我们还剖析 ...

  2. python学习-- django 2.1.7 ajax 请求

    #--------------views.py---------------------- def add(request): a = request.GET['a'] print(a) b = re ...

  3. pl/sql 函数及与存储过程的区别

    函数用于返回特定的数据,当建立函数时,在函数头部必须包含return子句.而在函数体内必须包含return语句返回的数据.我们可以使用create function来建立函数. 1).接下来通过一个案 ...

  4. Scrum基础知识图谱

    啰嗦一下 最近在学习scrum项目管理的知识,书上知识点分散,很难有整体的视角来看scrum有哪些核心知识,故制作了思维导图,望给和我一样容易迷失的人一样,起到一个指引作用,废话不多说,直接上图 图谱

  5. layer弹窗在键盘按回车将反复刷新

      条件:弹窗后不做任何点击操作或者聚焦操作对于layer.load,弹出后反复按回车,load层将不断刷新,即使设置了自动消失也只有等不按回车键才会生效.对于layer iframe层有表单就更糟糕 ...

  6. NOJ——1627Alex’s Game(II)(尺取)

    [1627] Alex’s Game(II) 时间限制: 2000 ms 内存限制: 65535 K 问题描述 Alex likes to play with one and zero as you ...

  7. Topcoder SRMCards ——贪心

    选择一个数x会删去x+1和x-1,问可以最多选多少次. 显然,对于一段连续的数列,贪心的从左向右选取是最优的. 然后就可以贪心的统计答案了. #include <map> #include ...

  8. 【bzoj4031】[HEOI2015]小Z的房间 Matrix-Tree定理+高斯消元

    [bzoj4031][HEOI2015]小Z的房间 2015年4月30日3,0302 Description 你突然有了一个大房子,房子里面有一些房间.事实上,你的房子可以看做是一个包含n*m个格子的 ...

  9. Springboot 版本+ jdk 版本 + Maven 版本的匹配

    Spring boot 版本 Spring Framework jdk 版本 maven 版本 1.2.0 版本之前 6 3.0 1.2.0 4.1.3+ 6 3.2+ 1.2.1 4.1.3+ 7 ...

  10. Oracle学习记录1

    1.current_date与sysdate区别 在oracle中current_date与sysdate都是显示当前系统时间, 其结果基本相同,但是有三点区别:a. current_date返回的是 ...