Hi,
I am a beginner in Android developmet, and I posted a question in
Android Beginners, but had no answers... I have a problem refreshing
the AutoComleteTextView, it looks like a bug to me... any suggestion?
As shown in the example below I use an ArrayAdapter's list of data 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...
In this simple example 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, but 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 Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---