无法更新当前行列表视图,我的代码如下

时间:2016-12-28 06:40:38

标签: android

给出以下代码来更新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 } } 中的当前行,但列表没有得到更新,请告诉我代码中是否有任何错误

{
    _id : xxx,
    children : [
        {
            childrenOfChildren : [
                {
                    price : xxx
                },
                {
                    price : xxx
                },
                {
                    price : xxx
                }
            ]
        },
        {
            childrenOfChildren : [
                {
                    price : xxx
                },
                {
                    price : xxx
                },
                {
                    price : xxx
                }
            ]
        },
        {
            childrenOfChildren : [
                {
                    price : xxx
                },
                {
                    price : xxx
                },
                {
                    price : xxx
                }
            ]
        }
    ]
},

{
    _id : xxx,
    children : [
        {
            childrenOfChildren : [
                {
                    price : xxx
                },
                {
                    price : xxx
                },
                {
                    price : xxx
                }
            ]
        },
        {
            childrenOfChildren : [
                {
                    price : xxx
                },
                {
                    price : xxx
                },
                {
                    price : xxx
                }
            ]
        },
        {
            childrenOfChildren : [
                {
                    price : xxx
                },
                {
                    price : xxx
                },
                {
                    price : xxx
                }
            ]
        }
    ]
},

{
    _id : xxx,
    children : [
        {
            childrenOfChildren : [
                {
                    price : xxx
                },
                {
                    price : xxx
                },
                {
                    price : xxx
                }
            ]
        },
        {
            childrenOfChildren : [
                {
                    price : xxx
                },
                {
                    price : xxx
                },
                {
                    price : xxx
                }
            ]
        },
        {
            childrenOfChildren : [
                {
                    price : xxx
                },
                {
                    price : xxx
                },
                {
                    price : xxx
                }
            ]
        }
    ]
},

{
    _id : xxx,
    children : [
        {
            childrenOfChildren : [
                {
                    price : xxx
                },
                {
                    price : xxx
                },
                {
                    price : xxx
                }
            ]
        },
        {
            childrenOfChildren : [
                {
                    price : xxx
                },
                {
                    price : xxx
                },
                {
                    price : xxx
                }
            ]
        },
        {
            childrenOfChildren : [
                {
                    price : xxx
                },
                {
                    price : xxx
                },
                {
                    price : xxx
                }
            ]
        }
    ]
}

2 个答案:

答案 0 :(得分:1)

只需将您的行更改为:

upload-sym

答案 1 :(得分:0)

也许您可以删除第jsonCustomAdapter.notifyDataSetChanged();行。在TextView someText上调用setText()方法后,TextView的内容已更改。

如果有任何错误,请指正。