我在实时更新TextView时遇到问题.我想用自定义适配器实时更新ListView的TextView.我有我的套接字I / O处理程序,我收到一个
JSON消息.我想解析这个
JSON并使用setText()将该文本放入特定的列表行.如何获取该ListView行的索引并更新其TextView?
responseid=object.getString("ResponseID");
if(responseid!=null){
for(int j=0;j
//If the countryList row match then i want to update the textView of that particular row
if(countryList.get(j).getName().equals(caseid)) {
int oldcount = Integer.parseInt((dataAdapter.findViewById(R.id.replycount)).getText().toString());
int total=oldcount+1;
(dataAdapter.findViewById(R.id.replycount)).setText(Integer.toString(total));
dataAdapter.notifyDataSetChanged();
}
}
}
//Here is my solution
for(int j=0;j
{
if(countryList.get(j).getName().equals(caseid))
{
String oldcount = countryList.get(j).getCount();
int oldcountint = Integer.parseInt(oldcount);
int newcount = oldcountint + 1;
countryList.get(j).setCount(Integer.toString(newcount));
dataAdapter.notifyDataSetChanged();
break;
}
}