AutoCompleteTextView update problem

by Tim » Thu, 05 Nov 2009 01:21:48 GMT

Sponsored Links
 Hi guys

I am completely stuck on this for a few days...any help will be super

I have an AutoCompleteTextView which I want to populate with artist
names based on what the user types. I have a method which makes a call
to the Musicbrainz API which takes a few seconds so I do that in a
separate thread.

The problem is that when I get the list of artist names back from
Musicbrainz, I try and update the ArrayAdapter with a Handler on the
UI thread (which is called from the Musicbrainz thread), but its only
on the next letter entered in the textview that the ArrayAdapter
changes are displayed to the user.

Here is my code:

public void onCreate(Bundle savedInstanceState) {
                AutoCompleteTextView actv = (AutoCompleteTextView) findViewById
                adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, new ArrayList<String>());


TextWatcher textWatcher = new TextWatcher() {

                public void onTextChanged(CharSequence s, int start, int 
before, int
count) {
                        Thread t = new Thread() {
                                public void run() {
                                        ArrayList<String> names = 
(ArrayList<String>) getArtistStrings
                                        artistNames = names;

                public void beforeTextChanged(CharSequence s, int start, int 
int after) {

                public void afterTextChanged(Editable s) {

private String getInput() {
                EditText artistInput = (EditText) findViewById
                String artistSearchString = artistInput.getText().toString();
                return artistSearchString;

private void updateTextAdapter(List<String> data) {
                for (String artistName : data) {

        private Handler messageHandler = new Handler() {

                public void handleMessage(Message msg) {



Other Threads

1. Calendar Broadcast Intents

I'm trying to capture when a calendar reminder goes off.  What I'm
trying to do right now is use a BroadcastReceiver and receive an
intent from the calendar.  Is there an intent that gets broadcast when
a calendar reminder goes off?  If so what is its name, or where can I
find it?  Is there a list of all the calendar intents somewhere?


2. 1dp=1/160 inch ?

In Android documentone, dp is one pixel on a 160 dpi screen.  So I
think 1dp=1/160 inch. Am I right?  Are they different in use?

3. Hide application in Home dinamically

4. How to set color key for hardware overlay engine?

5. Cupcake and master branch

6. setting ringtones from raw files

7. question about terminal developer