I'm trying to have an auto complete text view to help users pick
contacts (ALMOST identical to the API demo for the autocomplete
contacts + hint). However, instead of setting the text into the
autocomplete "edit text" field, I want the name to appear somewhere
else (i.e. textview, listview, etc.).
What i want: So when a user clicks on a selection from the drop down
hint list, the name automatically appears in DIFFERENT textview.
Where I am:
I'm currently using autoCompleteTextView.setOnItemClickListener, and
this works GREAT with "touchmode" (using my mouse). However, this does
not work when the DPAD_CENTER is clicked. Is this a bug? or do I need
to do something else?
What I've tried + problems:
- onKeyDown -> This isn't specific to the hint list created by
autocompletetextview. So this gets called anytime the user clicks the
dpad_center button
- creating a class that extends autoCompleteTextView -> The only
method I can override is the setOnItemClickListener and I just
couldn't figure out what I needed to change.
Where I use it:
Using java Syntax Highlighting
- protected void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- //Point to XML layout
- setContentView(R.layout.main);
- Cursor peopleCursor = getContentResolver().query(Contacts.People.CONTENT_URI,
- PEOPLE_PROJECTION, null, null, Contacts.People.DEFAULT_SORT_ORDER);
- ContactListAdapter Contactadapter = new ContactListAdapter(peopleCursor,this);
- AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.item);
- textView.setAdapter(Contactadapter);
- textView.setOnItemClickListener(click_person);
- }
- // the onItemClickListener instance:
- private OnItemClickListener click_person = new OnItemClickListener(){
- public void onItemClick(AdapterView v, View v2, int i, long j)
- {
- // <set text in a textview with id = whatever>
- }
- };
Parsed in 0.012 seconds, using GeSHi 1.0.8.4
please help!! thanks in advance!