0

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 ?

Bishan
  • 15,211
  • 52
  • 164
  • 258

1 Answers1

1

Change

usernames_adapter.setNotifyOnChange(true);

TO

usernames_adapter.notifyDataSetChanged();

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

RobinHood
  • 10,897
  • 4
  • 48
  • 97
kyogs
  • 6,766
  • 1
  • 34
  • 50