autocomplete control with display text different than form value - android

Is there a default control or third party library available in android for creating an auto complete UI control which will allow me to use different values for display text on the control and the actual form value. For example in HTML we have options which will allow us to set different values for value and label for it as shown below.
<select><option value="NJ">New Jersey</option></select>
I have States information in SQLlight database. I want to create an autocomplete UI control which will display the statename in autocomplete options but when selected the form value should be the statecode but not the name.

Related

I want to set a value in textField and not being able to change this value, only possible to insert new values. (kotlin)

I have a registration form, when I select an especific option on input, a textField this form receive a value that cannot be changed, being able to only type with other values ​​in this textField.
If you want to have a text field only the app can update (and the user can't type into), use a TextView.
If you want them to be able to type into it, but you want to be able to set a value and "lock" it so they can't edit it anymore, you can use an EditText and do enabled = false. That also greys out the field - if you don't want that, you can do inputType = EditorInfo.TYPE_NULL to prevent the keyboard from appearing.
If you want a fixed set of options that the user can choose from, you can use an AutoCompleteTextView or the Material Components equivalent

how to getstandard value from Spinner with multilanguage app on Android

I've an App where user can post photo and give some attributes to it.
Users can determine which category the photo belongs within a set of default categories, i try to show the categories options in a Spinner and the values come from a xml array compiled into the app.
This way i can show the categories in whichever language user is running the app.
The problem i have is to convert the value got from spinner back into a standard set for store in my database. Because depending of what language user set, i get the value as a different word and is a nightmare to create a converter which could handle it and translate from N different languages into my standard enum.
I would like to do something like radiobutton, like each option has a label (in whatever langague user wants) and a value (which i can define in a stardard way) so when i get selectedItemValue() i always get same value independent of language.
Is there any way to do that?
I advise you to use res/raw/ with different qualifiers depending on your locals instead of using string array.
It helps you to store json files in them. So you can have a list of custom objects which have both title and id.
And you store id in the database, and id is the same in all locals.

How to display word dictionary with custom keypad in android

I have successfully created a custom key pad in my application but i am unable to find out how to display a dictionary of words like android default keypad which appear at the top whenever we type.
1st you need to take an AutoComplete TextView
Afterwards , you need to follow this example:
Creating a Search Interface
In this example the ListView's Data-Source is being changed when the text is entered in Search Bar.You need to change the Data-Source of AutoComplete TextView as the user enters different texts.
I hope this will solve your problem.

Number Picker as present in Dialog (Android)

I am trying to implement NumberPicker in my application. I want the view to be as show in
Dialogs Guide,which is
what i get when i implement the number picker
Also, i do not want to have text selected when i tap on selected item, from scroller
P.S. I tried searching around google and SO, but could not find correct answer for my question
I implemented solution provided here at SO.
Have already defined listener for value changed.
Tutorial/Guide is here, it just a quick overview of NumberPicker widget.
I want to implement view similar to
I think that depends on theme used
See NumberPicker at developer.android.com
Class Overview topic:
A widget that enables the user to select a number form a predefined range. There are two flavors of this widget and which one is presented to the user depends on the current theme.
If the current theme is derived from Theme the widget presents the current value as an editable input field with an increment button above and a decrement button below. Long pressing the buttons allows for a quick change of the current value. Tapping on the input field allows to type in a desired value.
If the current theme is derived from Theme_Holo or Theme_Holo_Light the widget presents the current value as an editable input field with a lesser value above and a greater value below. Tapping on the lesser or greater value selects it by animating the number axis up or down to make the chosen value current. Flinging up or down allows for multiple increments or decrements of the current value. Long pressing on the lesser and greater values also allows for a quick change of the current value. Tapping on the current value allows to type in a desired value.

Android NOT autoComplete or spinner

I have related input text fields in my android application.
The user first enters a parent value (using autocomplete text)
for the related child text entry i have tried a spinner and autocomplete text.
the spinner shows existing values, which is a good start, however i need the user to be able to enter new values as well. Once the user adds a new value this will be incorporated in the drop down list on subsequent views of the screen.
the user may not know all available values so autocomplete doesnt satisfy my requirements as you have to know what is already in the list for it to assist you.
i feel spinner is the best starting point for my child text entry field.
How do i enable text entry into a spinner?
whats the "Best" solution for this problem?

Categories

Resources