Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Auto Complete Text View Help

Auto Complete Text View Help

Put your problem here if it does not fit any of the other categories.

Auto Complete Text View Help

Postby drake » Thu Feb 28, 2008 1:49 am

Situation:

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:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. protected void onCreate(Bundle icicle) {
  2.  
  3.                 super.onCreate(icicle);
  4.  
  5.  
  6.  
  7.                 //Point to XML layout
  8.  
  9.                 setContentView(R.layout.main);
  10.  
  11.  
  12.  
  13.         Cursor peopleCursor = getContentResolver().query(Contacts.People.CONTENT_URI,
  14.  
  15.                 PEOPLE_PROJECTION, null, null, Contacts.People.DEFAULT_SORT_ORDER);
  16.  
  17.  
  18.  
  19.         ContactListAdapter Contactadapter = new ContactListAdapter(peopleCursor,this);
  20.  
  21.         AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.item);
  22.  
  23.  
  24.  
  25.         textView.setAdapter(Contactadapter);
  26.  
  27.         textView.setOnItemClickListener(click_person);
  28.  
  29.         }
  30.  
  31.  
  32.  
  33. // the onItemClickListener instance:
  34.  
  35.     private OnItemClickListener click_person = new OnItemClickListener(){
  36.  
  37.         public void onItemClick(AdapterView v, View v2, int i, long j)
  38.  
  39.         {
  40.  
  41.                 // <set text in a textview with id = whatever>
  42.  
  43.         }
  44.  
  45.     };
  46.  
  47.  
Parsed in 0.012 seconds, using GeSHi 1.0.8.4

please help!! thanks in advance!
drake
Freshman
Freshman
 
Posts: 4
Joined: Thu Feb 28, 2008 1:45 am

Top

Postby Ishtar » Mon Mar 03, 2008 11:33 am

Just an idea:

Extend AutoCompleteTextView and override
protected void replaceText(CharSequence text)

If I understand the API correctly this is called when the user (one way or another) selects an item from the dropdown.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. class ContactPicker extends AutoCompleteTextView
  3.  
  4. {
  5.  
  6. protected void replaceText(CharSequence text)
  7.  
  8. {
  9.  
  10.   super.replaceText(text);
  11.  
  12.   myReferenceToOtherTextOrListView.setText(text);
  13.  
  14. }
  15.  
  16. }
  17.  
  18.  
Parsed in 0.010 seconds, using GeSHi 1.0.8.4
Ishtar
Experienced Developer
Experienced Developer
 
Posts: 50
Joined: Wed Jan 16, 2008 10:22 pm
Location: Netherlands

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 12 guests