【发布时间】:2010-12-22 16:56:40
【问题描述】:
大家好,如果我尝试将字符串分配给字符串数组,我会收到 NULL POINTER EXCEPTION.. 请给我一个解决方案..
这是我的代码,我在这一行中得到空指针 thumbs[j]=title; 作为代码如下...
for (int i = 0; i < items.getLength(); i++) {
Node item = items.item(i);
NodeList properties = item.getChildNodes();
for (int j = 0; j < properties.getLength(); j++) {
Node property = properties.item(j);
String name = property.getNodeName();
if (name.equalsIgnoreCase("title")) {
try{
property.normalize();
Spanned title2 = Html.fromHtml(property.getFirstChild().getNodeValue().replaceAll("\\<.*?>", ""));
title = title2.toString();
}catch(Exception e){
Log.v("Exception",""+e);
}
thumbs[j]=title;
}
}
}
【问题讨论】:
-
你在哪里初始化
thumbs?可以给我们看看吗?