animation-list AnimationDrawable null 空指针 原因
来源:互联网 发布:js传值到jsp 编辑:程序博客网 时间:2024/04/30 08:43
在 res/drawable 目录下 有个voice_to_icon.xml文件
<?xml version="1.0" encoding="utf-8"?><animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false"> <item android:drawable="@drawable/chatto_voice_playing_f1" android:duration="200" /> <item android:drawable="@drawable/chatto_voice_playing_f2" android:duration="200" /> <item android:drawable="@drawable/chatto_voice_playing_f3" android:duration="200" /></animation-list>
我是这样引用:
private void showAnimation() {// play voice, and start animationif (message.direct == EMMessage.Direct.RECEIVE) {voiceIconView.setImageResource(R.drawable.voice_from_icon);} else {voiceIconView.setImageResource(R.drawable.voice_to_icon);}voiceAnimation = (AnimationDrawable) voiceIconView.getDrawable();if (voiceAnimation != null)voiceAnimation.start();}
在执行到 voiceAnimation= (AnimationDrawable)voiceIconView.getDrawable();时候,报了一个空指针异常
原因是 :
@drawable/chatto_voice_playing_f1
被我放在了 res/drawable-land-hdpi 目录下
总结 :
phone开发resource放在 pad resource中会出现空指针异常,放资源的时候,得慎重注意这一状况
本小计完结了
0 0
- animation-list AnimationDrawable null 空指针 原因
- NULL 空指针
- 空指针NULL
- NULL指针与空指针
- NULL 空指针 野指针
- android animation(AnimationDrawable)
- 空指针NULL、野指针、通用指针
- 空指针、NULL指针、零指针
- NULL指针,空指针,野指针
- 空指针、NULL指针、野指针
- 空指针:NULL还是0
- void * 与 空指针NULL
- 空指针(NULL)那些事?
- 空指针(NULL,0),野指针,void*
- driver出现空指针原因
- 空指针异常的原因
- 空指针异常常见原因
- 【C++】NULL指针、零指针、空指针、野指针
- linux 操作系统中find文件搜索命令的使用
- scala flatMap 简介
- MSP430 SPI总线详解
- wifi详解(五)
- 【JAVA】内嵌JettyServer结合springMVC、mybatis实现轻量化系统部署
- animation-list AnimationDrawable null 空指针 原因
- Intent基本介绍
- 按钮 边角 相关设置
- 32位的tetview and medit 在64bit的linux运行,有很多32bit的库没有安装,错误不断之解决办法。
- 旋转动画
- poj 1696
- Java基本语法-----java二维数组
- hdu 1003
- redis范围查询应用-查找IP所在城市<转>