2016-12-28 48 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的内容已更改。

如果有任何错误,请纠正我。