Weird NullPointerException in Spinner

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 09:15:41
Cuong Thai

As Peterdk describe here . You dont need to remove

android:ellipsize="marquee"

He suggests using:

inflater.inflate(android.R.layout.simple_spinner_item, null);//WRONG inflater.inflate(android.R.layout.simple_spinner_item, parent, false);//GOOD

That fixed my issue. I guess Android 4.4 is trying to be strict about inflating layout

So i check that line in TextView class in makeNewLayout method and found that this exception is happening on this line final int height = mLayoutParams.height; Layout params are probably null.. and this line is in block that handle ellipsizing long text .. so i removed that textView attribute in xml android:ellipsize="marquee" and then problem really disappears .. strange strange

Thanks. I got away with the crash by removing android:ellipsize from all of my layouts.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!