问题
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);
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 ?
回答1:
Change
usernames_adapter.setNotifyOnChange(true);
TO
usernames_adapter.notifyDataSetChanged();
this method work only when you delete, update and insert item.
来源:https://stackoverflow.com/questions/14846752/setnotifyonchangetrue-not-working