setNotifyOnChange(真)不工作 [英] setNotifyOnChange(true) not working
问题描述
我在我的Android活性增加低于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)$ C插入的数据$ C>插入之后。所以我用
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屋!