我想實時更新ListView中的TextView。我有一個套接字連接,我正在偵聽json消息,並且我想解析/標識json以更新現有的5個TextView中的一個名單。動態更新TextView
responseid=object.getString("ResponseID");
if(responseid!=null){
for(int j=0;j<myList.size();j++){
//If value match then I want to update the textView of that particular row
if(myList.get(j).getName().equals(cid)) {
//I successfully get the value of Textview of particular row of Listview now I want to update the this Textview with item variable below.
String item = (String) myAdapter.getItem(j).getName();
//Here i want to update Textview
myAdapter.notifyDataSetChanged();
}
}
}
所以會發生什麼,如果你運行該代碼?它不更新? logcat中有任何錯誤之王嗎? – 2013-03-02 00:08:16
確切地說,你需要什麼? – vgarzom 2013-03-02 00:08:17
您的項目是您定義的對象類型嗎? – abbath 2013-03-02 00:14:01