Hi,
        I have some problems refreshing the ArrayAdapter's list of
data used for an AutoCompleteTextView. The ArrayAdapter loads its
initial data present in the ArrayList, but if the ArrayList changes,
and the notifyDataSetChanged is called, the Adapter doesn't refresh
its elements...
Here is a simple example, with an AutoCompleteTetxView and a Button;
pressing the Button you can add a new string to the ArrayList, then
notify the dataset changed, but the Adapter doesn't include the new
String, just the initial values ITEM1 e ITEM2.
Where am I wrong?

Best Regards,
JKrapp

[...]
                mylist = new ArrayList<String>();
                mylist.add("ITEM1");
                mylist.add("ITEM2");

                myEditTextAdapter = new ArrayAdapter<String>(this,
                                android.R.layout.simple_dropdown_item_1line, 
mylist);

                myEditText = (AutoCompleteTextView) findViewById
(R.id.AutoCompleteTextView01);
                myEditText.setAdapter(myEditTextAdapter);

                myButton = (ImageButton) findViewById(R.id.ImageButton01);

                myButton.setOnClickListener(new OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            mylist.add(myEditText.getText().toString());
                            myEditText.setText("");
                            myEditTextAdapter.notifyDataSetChanged();
                        }

                });
[...]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to