1. 2015 is going to be a great year for Android! Why wait??
    Samsung Galaxy Note 5 | Samsung Galaxy S6 | HTC One M9
  2. New Forum Created: Samsung Gear VR!

Force user to use one of the autocomplete options


  1. ScotDiddle

    ScotDiddle Member

    Hello All,

    My business app requires specific items to be entered into EditText Fields. (Zip codes for the state of Virginia only, for example.) I am using an AutoCompleteTextView, and it is working as advertised. How do I ensure that only one of the items shown in the auto-complete drop-down list are allowed in the edit box field.

    Thanks,

    Scot L. Diddle, Richmond VA

    Advertisement
    :
  2. jonbonazza

    jonbonazza Well-Known Member

    For this, you should be using a Spinner control instead of an EditText.
  3. ScotDiddle

    ScotDiddle Member

    jonbonazza, Thanks for the reply, but a spinner would be impractaical. Virginia has a lot of zip codes... Also, I have a bunch of String[] arrays where the AutoComplete value might be up to 80 characters or more... Spinner display would look awful and be hard to navigate in both instances.
    Any way to do what I want ?

    Thanks again.

    Scot L. Diddle, Richmond VA
  4. jonbonazza

    jonbonazza Well-Known Member

    As far as I know, there isn't. Best you can do is validate the input before submitting it.
    ScotDiddle likes this.
  5. ScotDiddle

    ScotDiddle Member

    jonbonazza,

    Thanks, that's what I figured. Maybe after I become proficient in Java I will write my own extended class :)

    I am validating before using user-supplied values... Just good programming practice, and I have been practicing since 1980.

    Scot
Loading...

Share This Page