how to read the selected item of an autocompletetextview?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

how to read the selected item of an autocompletetextview?

Postby emmanu27 » Thu May 01, 2008 4:50 pm

i want to read the selected item of textview1 and put it in a string

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class Formulaire extends Activity{
  2.  
  3.     public void onCreate(Bundle icicle) {
  4.  
  5.         super.onCreate(icicle);
  6.  
  7.         ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(this,
  8.  
  9.                 android.R.layout.simple_list_item_1, VILLES);
  10.  
  11.        
  12.  
  13.         AutoCompleteTextView textView1 = (AutoCompleteTextView) findViewById(R.id.ville_depart);
  14.  
  15.    }
  16.  
  17.    static final String[] VILLES = new String[] {  
  18.  
  19.         "Bavois", "Bussigny", "Chavornay", "Cossonay", "Eclepens", "Ependes",
  20.  
  21.         "Essert-Pittet","Lausanne", "Vufflens-la-ville","Yverdon-les-bains"};
  22.  
  23. }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


thank you for all.
emmanu27
Once Poster
Once Poster
 
Posts: 1
Joined: Thu May 01, 2008 4:31 pm

Top

Postby plusminus » Fri May 16, 2008 10:38 am

Hello emmanu27,

try using a [font=Lucida Console]OnItemSelectedListener[/font] in [font=Lucida Console]setOnItemSelectedListener[/font].

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby dkkundudolan » Tue Dec 09, 2008 5:13 am

Hi plusminus,

By using the setOnItemSelectedListener, before selecting the Item its going to the next page.
is it possible to make like this:

Suppose, there is few country names starting with "U". so i will enter"U"in the AutocompleteTextView option, and the country list will display which are starting with "U". Afterthat i want to click on my choicable country and by clicking on that, i can read regarding the country.

can you give me a suggestion? waiting for reply.........

Thanks.
dkkundudolan
Experienced Developer
Experienced Developer
 
Posts: 83
Joined: Mon Mar 03, 2008 12:50 pm

Postby dkkundudolan » Tue Dec 09, 2008 10:50 am

Hi emmanu27,

use setOnItemClickListener. u will get the result.

Thanks.
dkkundudolan
Experienced Developer
Experienced Developer
 
Posts: 83
Joined: Mon Mar 03, 2008 12:50 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 9 guests