异常:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.william/com.william.ResultActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x14

解决:TextView 对象中有一个方法为setText(param) ,当你传入一个int类型的值时,代码是不会报错的,但是当你运行着程序的时候,就会报出上面的错误。上网查了一些资料,最后知道为什么会有这样的错误出现,因为这是由于Android 会认为你传入的 int 型的数值是某个 resource 的 id ,那运行时就会出错。

myResult.setText(lastValue+"")代码,如果只myResult.setText(lastValue)写的话,那么这个lastValue值就是一个int类型的值了,那么只需要在后面加上一个空的字符串就可以了。

==================

但是我并无以上网友介绍的问题,我的问题是:

intent = new Intent(PerformanceTestMainActivity.this, PrinterTestActivity.class);
   this.startActivity(intent);

就因为这个。唉,什么原理?

java.lang.RuntimeException: Unable to start activity ComponentInfo的更多相关文章

  1. 转载java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.spinner/com.example.spinner.MainActivity}: java.lang.NullPointerException

    今天学习Android开发突然遇到了这个问题,查阅了很多资料,并且对集中原因进行了分析. 错误信息字符串:java.lang.RuntimeException: Unable to start act ...

  2. Java.lang.RuntimeException: Unable to instantiate activity ComponentInfo

    如果你更新了ADT的新版本,而工程文件中使用了其他的jar包,也可能会出现"java.lang.RuntimeException: Unable to instantiate activit ...

  3. java.lang.RuntimeException: Unable to instantiate activity ComponentInfo异常总结

    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo异常总结 做android开发的可能都碰到"j ...

  4. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ex.activity/com.ex.activity.LoginActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ex.activity/com.ex.activity.L ...

  5. java.lang.RuntimeException: Unable to start activity ComponentInfo……AppCompat does not support the current theme features

    Android测试时出现闪退的问题,出现了如下所示异常: java.lang.RuntimeException: Unable to start activity ComponentInfo{thon ...

  6. Android开发中java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}

    Android开发中java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}: java.lang.NullPoi ...

  7. android studio调试报错:java.lang.RuntimeException: Unable to start activity ComponentInfo

    报错信息: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.pro_u_loc/com.e ...

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

  9. Android java.lang.RuntimeException: Unable to instantiate activity ComponentInfo 特殊异常

    本来是不想写的,因为这个异常太常见了,而且也容易处理.但是还是决定记录一下,因为之前遇到过,没留心,今天又遇到了,苦逼了,想了好大一会儿才想起来. 通常容易找的就不写了,今天写个特殊的. 现象:当你在 ...

随机推荐

  1. css中em与px

    Px是绝对定位   em是相对定位 1. em的值并不是固定的: 2. em会继承父级元素的字体大小. em应用: 1. body选择器中声明Font-size=62.5%:(注:在ie中把body选 ...

  2. shell命令实战详解

    1.解析路径获取文件名和目录名. 获取文件名      #awk解法:用“/”做分隔符,然后打印出最后的那一部分. resFile=`echo /tmp/csdn/zhengyi/test/adb.l ...

  3. The number of positions

    Description The number of positions time limit per test: 0.5 second memory limit per test: 256 megab ...

  4. iphone:自定义UIAlertView

    由于项目中有这样一个需求:需要在保存是弹出框选择保存的地点.选择UIAlertView来实现,但是要在UIAlertView中增加UISwitch的控件,这就需要自定义一个继承UIAlertView的 ...

  5. 21. 无法执行该操作,因为链接服务器”Server_202”的 OLE DB 访问接口 “SQLNCLI10″ 无法启动分布式事务”

    无法执行该操作,因为链接服务器”Server_202”的 OLE DB 访问接口 “SQLNCLI10″ 无法启动分布式事务” 原因:调用存储过程的方式有问题,必须用JDBC方式调用存储过程才可以正常 ...

  6. lint使用简介

    LINT工具是一种软件质量保证工具,许多国外的大型专业软件公司,如微软公司,都把它作为程序检查工具,在程序合入正试版本或交付测试之前一定要保证通过了LINT检查,他们要求软件工程师在使用LINT时要打 ...

  7. Cortex-M3 .s启动文件分析

    1. 基本概念(CMSIS): Cortex Micro-controller Software Interface Standard,微控制器软件接口标准. 2. CMSIS标准的文件结构: a) ...

  8. iOS 4.2 SDK安装

    iOS 4.2 SDK安装 ◆系统版本:10.6.5 ◆硬件配置: ◆10G空间,3.5G内存,显卡:GMA950 Xcode 3.2.5和iOS 4.2 SDK下载:http://developer ...

  9. HDU 5716 带可选字符的多字符串匹配(ShiftAnd)

    [题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=5716 [题目大意] 给出一个字符串,找出其中所有的符合特定模式的子串位置,符合特定模式是指,该子串 ...

  10. 一些复数运算的C语言实现

    很久不写博客了.第一次写博客是在04年,最近的一次还是在大学时,在学校时,甚至还有过自己去买虚拟主机搭WordPress写博客的经历.现在工作时间越长,越发现积累的重要性.那么就从这里开始吧,重新开始 ...