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
  • 14,610
  • 50
  • 157
  • 245

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,771
  • 4
  • 46
  • 94
kyogs
  • 6,598
  • 1
  • 33
  • 50