当我将我的应用程序从 eclipse 移动到 android studio 时。我在这部分代码中有错误:
AddList.Add(添加);
Addlist 是一个 Listview 小部件
for(int i=0;i<jArray.length();i++){
Advertisement Add=new Advertisement();
JSONObject jRealObject=jArray.getJSONObject(i);
//Set the Value
Add.setTitle(jRealObject.getString("Title"));
Add.setLikes(jRealObject.getString("Likes"));
//Add Data to List
AddList.Add(Add);
}
最佳答案
显示您的适配器代码。 我认为在您的 AddList 中添加您的 Advertisement 之后,您应该通知您的适配器数据集已更改功能。
adapter.notifiDataSetChanged();
关于android - 将数据添加到 ListView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32123799/