if ((mRawFoodN != null) && (Integer.parseInt(mRawFoodN.getTotal()) > 0)) {
totalFoods = Integer.parseInt(mRawFoodN.getTotal());
dataArray = new ArrayList<ListFoodItem>();
for (Food food : mRawFoodN.getNutrientFoodList()) {
System.out.println("food "+food+" Constants.SMALL_IMAGE_URL "+Constants.SMALL_IMAGE_URL);
temp = new ListFoodItem(food.getId(), Constants.SMALL_IMAGE_URL.concat(food.getImage()),
food.getName(), food.getDesc());
dataArray.add(temp);
} 错误出现在这 temp = new ListFoodItem(food.getId(), Constants.SMALL_IMAGE_URL.concat(food.getImage()),
food.getName(), food.getDesc());经测试 food非空 Constants.SMALL_IMAGE_URL为常量 难道还有可能为空的变量吗?
totalFoods = Integer.parseInt(mRawFoodN.getTotal());
dataArray = new ArrayList<ListFoodItem>();
for (Food food : mRawFoodN.getNutrientFoodList()) {
System.out.println("food "+food+" Constants.SMALL_IMAGE_URL "+Constants.SMALL_IMAGE_URL);
temp = new ListFoodItem(food.getId(), Constants.SMALL_IMAGE_URL.concat(food.getImage()),
food.getName(), food.getDesc());
dataArray.add(temp);
} 错误出现在这 temp = new ListFoodItem(food.getId(), Constants.SMALL_IMAGE_URL.concat(food.getImage()),
food.getName(), food.getDesc());经测试 food非空 Constants.SMALL_IMAGE_URL为常量 难道还有可能为空的变量吗?
int otherLen = str.length();
if (otherLen == 0) {
return this;
}
char buf[] = new char[count + otherLen];
getChars(0, count, buf, 0);
str.getChars(0, otherLen, buf, count);
return new String(0, count + otherLen, buf);
}
看看String concat源码就明白了。