Error android.content.res.Resources$NotFoundException: File from xml type layout resource ID #0x102000a

喜你入骨 提交于 2019-12-03 11:04:58
Jonathan Roth

set the id of your listView to

android:id="@id/android:list"

I dont know, whether

android:id="@android:id/list"

does work correctly

I had the same problem. I was setting the text like this:

statusView.setText(firstVisiblePosition);

The problem was that firstVisiblePosition was an integer. Compiler didn't complain. Fixed it by

statusView.setText(""+firstVisiblePosition);

Sounds lame but if you are using Eclipse, have you tried cleaning and rebuilding your project? That fixed a similar problem I was having.

Khushboo

I am also able to solve the problem by converting the Integer value to String while using:

name.setText(name_value_needs_to_be_string);

where name is a TextView.

The compiler interprets your int argument as a resource reference and assumes you are calling:

 public final void setText (int resourceId)

but your intention was to call

 public final void setText (CharSequence text)

To fix it, do like so:

myTextView.setText(Integer.toString(myIntegerValue));

I solved this problem by copying XML file from layout-land directory to layout (or vice versa). Some devices have default landscape mode, others portrait. If that file does not exist in that mode, it throws this exception.

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