setNotifyOnChange(真)不工作 [英] setNotifyOnChange(true) not working

查看:926
本文介绍了setNotifyOnChange(真)不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的Andr​​oid活性增加低于codeS在 onResume()方法。

I have added below codes in onResume() method in my android activity.

    username.addTextChangedListener(this);
    usernames_adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_dropdown_item_1line,
            users.getUserList());
    username.setAdapter(usernames_adapter);
    usernames_adapter.setNotifyOnChange(true);

我使用的是SQL脚本将数据插入到数据库中。我需要显示在用户名用户名 AutoCompleteTextView)插入之后。所以我用 usernames_adapter.setNotifyOnChange(真); 。但它不工作。我必须强制停止我的应用程序,以显示对 AutoCompleteTextView 插入的数据。

I'm inserting data into database using sql script. i need to show inserted data on username (username is a AutoCompleteTextView)just after inserting. so i used usernames_adapter.setNotifyOnChange(true);. but it is not working. i have to Force Stop my application to show inserted data on AutoCompleteTextView.

我怎么能解决这个问题?

How could i solve this ?

推荐答案

修改

usernames_adapter.setNotifyOnChange(真);

usernames_adapter.setNotifyOnChange(true);

usernames_adapter.notifyDataSetChanged();

usernames_adapter.notifyDataSetChanged();

这种方法工作,只有当您删除,更新和插入项目。

this method work only when you delete, update and insert item.

这篇关于setNotifyOnChange(真)不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆