当我第二次运行我的应用程序时,它会给出这个错误。如果我清理我的项目,那么它运行正常。而且我启动了新的模拟器然后我的应用程序运行但它没有连续运行。
null java.lang.ArrayIndexOutOfBoundsException at com.warriorpoint.androidxmlsimple.SplashActivity.loadFeed(SplashActivity.java:140) at com.warriorpoint.androidxmlsimple.SplashActivity.access$0(SplashActivity.java:106)
我的代码在这里
private void loadFeed(){
try{
BaseFeedParser parser = new BaseFeedParser();
messages = parser.parse();
titles = new ArrayList<String>(messages.size());
description = new ArrayList<String>(messages.size());
link = new ArrayList<String>(messages.size());
arrays=new String[messages.size()][];
final List<String> imageURL=new ArrayList<String>(1);
imageURLAmit=new ArrayList<String>(messages.size());
for (com.warriorpoint.androidxmlsimple.Message msg : messages){
Spanned title=Html.fromHtml(msg.getTitle());
titles.add(title.toString());
link.add(msg.getLink().toString());
Spanned data=Html.fromHtml(msg.getDescription(),new ImageGetter() {
public Drawable getDrawable(String source) {
// TODO Auto-generated method stub
imageURL.add(source);
return null;
}
},null);
if(imageURL.size()!=0){
imageURLAmit.add(imageURL.get(0));
}else{
imageURLAmit.add("http://blog.kevinlearynet.netdna-cdn.com/files/applausemeter-300x200.jpg");
}
System.out.println("Position b4 loop : "+position);
int j;
arrays[position]=imageURL.toArray(new String[imageURL.size()]);
System.out.println("2D array colomn length : "+arrays[position].length);
position++;
System.out.println("Position afeter loop : "+position);
imageURL.clear();
description.add( data.toString());
System.out.println("End addition");
}
System.out.println("Final Image URL lenght : "+imageURL.size());
} catch (Throwable t){
Log.e("AndroidNews",t.getMessage(),t);
}
}
}