2016-12-28 40 views
1

給出下面給出的代碼在listview更新當前行,但該列表是沒有得到好心更新告訴我,如果我的代碼中的任何錯誤廣東話更新當前行ListView和我的代碼如下

private void update(int id) 
    { 

     int c = subaccountview.getChildCount(); 
     for (int i = 0; i < c; i++) 
     { 
      View view = subaccountview.getChildAt(i); 
     // if (view.getTag() == id) 
     // { 
       TextView someText = (TextView) view.findViewById(R.id.balancenamenew); 
       someText.setText(Sessiondata.getInstance().getRbalvalue()); 
       jsonCustomAdapter.notifyDataSetChanged(); 
     // } 

       // update view 
      } 
     } 
+0

use Log.i(TAG,DESCRIPTIYN); 'notifyDataSetChanged'之後,還有評論'更新視圖'兩個方括號關閉! – AndroSco

回答

1

只是改變你的行通知爲:

jsonCustomAdapter.notifyItemChanged(i) // i will be the position on which data is changed 
0

也許你可以刪除行jsonCustomAdapter.notifyDataSetChanged();。在調用TextView someText上的setText()方法後,TextView的內容已更改。

如果有任何錯誤,請糾正我。