Arayadapter only shows text when highlighted

by Android_n00b » Fri, 18 Sep 2009 08:47:50 GMT


Sponsored Links
 I have an arrayadapter which stores the names of the 12 months of the
year:
final String[] Months = new String[]
{"January","February","March","April","May","June","July","August",
                "September","October","November","December"};
ArrayAdapter<String> monthArray = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, Months);

I also have a textview where if I enter some text, the matching text
in the arrayadapter appears below the textbox.
final AutoCompleteTextView textView = (AutoCompleteTextView)
findViewById(R.id.testAutoComplete);
textView.setAdapter(monthArray);

For example, if I start typing the characters of January, I should see
the word January appear below the textbox (like how google suggest
works). So my program seems to be working, but when I start typing Jan
for example, a box appears below with the word January in it, but I
can only see the text when it is highlighted. So for some reason, the
text is the same colour as the background box(white in this case).
Anyone know why this is happening?

Thanks!

--~--~---------~--~----~------------~-------~--~----~



Arayadapter only shows text when highlighted

by Mark Murphy » Fri, 18 Sep 2009 17:26:46 GMT


 


What layout are you using for the ArrayAdapter used for the
AutoCompleteTextView?

 http://developer.android.com/guide/tutorials/views/hello-autocomplete.html 

ArrayAdapter adapter = new ArrayAdapter(this,
            android.R.layout.simple_dropdown_item_1line, COUNTRIES);

If you do not wish to use android.R.layout.simple_dropdown_item_1line,
that is fine, but you will need to then adjust your own custom layout to
have the right color scheme for drop-down lists.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.1 Available!

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Query about speech recognition

hi all..

im working with android for a while...im particularly interested in the
speech recognition feature that is included in the latest release of
android(1.5)...tried some programs with the recogniser intent interface..but
that didnt work out well...the android developer site had very little to
offer..and there was not much help in the web...all i want to know is how
the  ACTION_RECOGNIZE_SPEECH actually works...i created an intent object
passing the  ACTION_RECOGNIZE_SPEECH in the constructor and invoked the
activity(which obivously didnt work... though it compiled) . iam using
eclipse ganymede and android 1.5..thanks in advance
-- 


--~--~---------~--~----~------------~-------~--~----~

2. more parseable output from instrumented tests?

Looks like you answered your own question, but yes, passing the "-r"
flag gets you more parseable results. I don't believe the on device
test runner records per-test execution times.

There is some existing code for parsing the output of adb shell am
instrument -r in the Android source tree at
development/testrunner and
development/tools/ddms/libs/ddmlib/src/com/android/ddmlib/testrunner






--~--~---------~--~----~------------~-------~--~----~

3. Android Dev around Boston to help.

4. Issue with allocation tracker: I cannot get it to work.

5. plz help with camera application from my application

6. plz help with sdcard image file and push command not working!!

7. selector is not working! argh....