在安卓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. Fiddler证书安装不成功

    Fiddler 抓包https配置 提示creation of the root certificate was not successful 证书安装不成功 原文链接 在使用Fiddler抓包时,我 ...

  2. Cinder配置多Ceph后端步骤

    1. 检查cinder当前backend配置 使用cinder service-list,查看cinder-volume服务的Host字段格式. 旧版格式: 新版格式: 旧版中Host字段是cinde ...

  3. 使用supervisor方便调试程序

    调试过程中,有时需要修改代码,并时刻看到运行效果.如果每次终止程序又重启,会很麻烦. 可以使用supervisor,它可以监听代码文件,一旦发生改动会自动重启程序. 安装supervisor命令: n ...

  4. JAVA-基础(十) Swing

    在看到applet和Swing的时候,我想起了winform,以及java beans包中各种所谓的组件的时候,一切都那么似曾相识. Swing是AWT的扩展,它提供了更强大和更灵活的组件集合. 除了 ...

  5. JavaScript日期时间格式化函数

    这篇文章主要介绍了JavaScript日期时间格式化函数分享,需要的朋友可以参考下 这个函数经常用到,分享给大家. 函数代码: //格式化参数说明: //y:年,M:月,d:日,h:时,m分,s:秒, ...

  6. loj2256 「SNOI2017」英雄联盟

    真的是裸背包啊-- #include <iostream> #include <cstdio> using namespace std; typedef long long l ...

  7. luogu1972 [SDOI2009]HH的项链

    莫队裸题还不带修改 #include <algorithm> #include <iostream> #include <cstdio> #include < ...

  8. python 获得列表中每个元素出现次数的最快方法

    import collections import numpy as np import random import time def list_to_dict(lst): dic = {} for ...

  9. rsync配置和同步数据

    rsync的搭建配置1.环境和配置文件 rsyncd.conf(主配置文件) rsyncd.secrets(密码文件) pc1:192.168.0.1,rsync的服务器,配置rsyncd.conf文 ...

  10. animation总结

    1. animation结束后停在最后一帧 animation-fill-mode : forwards | both; /* 或者 */ animation: anim1 1s linear for ...