android - 无法更新当前行 ListView ,我的代码在下面给出

标签 android

给出下面的代码来更新 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
            }
        }

最佳答案

只需将通知更改为:

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

关于android - 无法更新当前行 ListView ,我的代码在下面给出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41356666/

相关文章:

android - 为什么我的代码没有在我的应用程序上更新? (更新 eclipse 后)

android - attrs.getAttributeIntValue 始终返回默认值

android - Genymotion 错误 : "Unable to load VirtualBox Engine" on Yosemite. VirtualBox 已安装

android - 切换用户或重新使用 Instagram 进行身份验证

android - FCM(Firebase 云消息传递)发送到多个设备

android - 如何使用 AddFooterView 使用字符串中的文本添加页脚?

java - list 合并因多个错误而失败,请参阅日志(错误 :Execution failed for task ':app:processDebugManifest' )

java - 期望 removeOnTabSelectedListener 表达式?

android - 形状背景渐变中的淡入淡出动画

android - 如何以编程方式将 EditText 的 InputType 设置为整数或小数?