I have an app in android that handles reporting about classes taken.
I have a edittext that is for entering the teacher's name, but there is a possibilty that there are more then one teacher.
I want to put all the names in the same edittext, similar to how its on gamil -
where you send a mail in gmail, you can enter multiple addresses (multiple values).
Best would be to have an autocompletetextview that will enalbe multiple names (values) in it, and the user can choose between pre-defined name options.
any ideas??
thnaks
Yes there is something you need.
You can use MultiAutoCompleteTextView from android widgets.
but here is more customizable version of it check this link TokenAutoCompleteTextView
It is same like gmail bubbles.It extends MultiAutoCompleteTextView from android widgets.
Hope it will help.Thanks
Related
I want to create a edit text where user suggestions will be shown when user typed "#" keyword.
For eg. If the selected user is: "James test user".
And if user press delete character(back space in android keyboard.) then it should delete the word by word instead of characters. just like first user will be deleted then test and then james.
Any lead will be great for me.
I've tried the https://github.com/linkedin/Spyglass and https://github.com/hendraanggrian/socialview. But they won't fulfill my requirements.
in android stuido I would like to code an activity, where the user can input numbers. For, example he types the number to the textfield, click 'OK' button, then the textfield gets clear, he types the second number, than the third, and after they give the third number the program goes to another activity and sayst thanks for the free number. I would like to save the three numbers for further use and have them in an ascending order. How should I do it?
I agree with Andrii, this is a very vague and general question. To get you pointed in the right direction though, you would want a layout with an number based-editText widget (for the user input). I would then add the button, and then implement OnClickListener for the button so that everytime the button is pressed, it calls a method you will define that will store the value in an array or list (which can be sorted), along with some kind of tracker to keep track of how many numbers have been entered - then clearing the editText field so that another number can be input; on the third number, the method calls the activity via intent or some other way saying "thanks for the free number".
This is all general and it is going to take quite a bit of work and API Guide/DeveloperDocs searching on the Android web site.
I have successfully added a word to Android's predefined user dictionary, but i want to create a custom dictionary which can only be accessed by my application.
For example: When i type "lol", the suggestions show me "laugh out loud" but when I want another meaning of "lol" then I can manually add another meaning of "lol" (eg, "xxxxxx" - so the next time the user writes "lol" in an EditText, the suggestions will show him "xxxxxx").
No other application should have access my dictionary data.
I have worked with spell checker class but it gives me only correct word and I can't my own word meanings.
Please give me some suggestions or links.
There is an Androids inbuilt class UserDictionary so that you can add your spells programmatically into that, Here is a link you can go through with , and which may relates to your problem .(In this solution nidhi has manged programmatically to retrieve data back)
Add word to user dictionary and retrieve them back from dictionary
In addition you can go through following links to :
http://developer.android.com/reference/android/provider/UserDictionary.html
http://developer.android.com/reference/android/provider/UserDictionary.Words.html
Moreover if you want a custom personal dictionary then manually you have to store words and retrieve them back .
Hope that helps !!!
I have currently a Preference in my application where the user is prompted to enter between 2 and 10 numerical values.
As this feature is only available for power users and beta testers, not for public release, I decided to let them enter a CSV value.
So, in my EditTextPreference, some users will enter: "1;20;30", some other will enter "1;10;10;10;10;10;10;10" etc...
After, in my code, I am just splitting these values to build an array and execute my code.
I have to admit that's not very professional, but that just works!
String[] patternString = PreferenceManager.getDefaultSharedPreferences(getBaseContext()).getString("vibPattern", "0;500;500;500;500;500;500;500").split(";");
The main issue is that I would like to check the validity of the String while the user is writing it!
Does some of you have an idea how to achieve that?
you need to use "addTextChangedListener" and act according to the text that was , well, changed...
if you wish, you can use regular expressions in order to check for validity .
why not just programmatically add the amount of wished boxes, (for an example) have a spinner(drop down menu), from where you can choose the amount, and then add that amount of edittext with numerical only?
In the EditText entry in your layout add the following:
android:inputType="number"
android:digits="0123456789,"
Then on the addTextChangeListener implementations you only have to check if a user just entered a bunch of commas.
Can someone explain the difference between MultiAutoCompleteTextView and AutoCompleteTextView?
AutocompleteTextView only offers suggestions about the whole sentence and MultiAutoCompleteTextView offers suggestions for every token in the sentence. You can specify what is the delimiter between tokens.
String[] words=new String[] {
"word1", "word2", "word3", "word4", "word5"
};
MultiAutoCompleteTextView macTv = (MultiAutoCompleteTextView) this.findViewById(R.id.mac_tv);
ArrayAdapter<String> aaStr = new ArrayAdapter<String>(this,android.R.layout.dropdown_item,words);
macTv.setAdapter(aaStr);
macTv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer() );
and:
<MultiAutoCompleteTextView
android:id="#+id/mac_tv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
/>
with this example the suggestion comes after every comma.
The choice between using the AutoCompleteTextView or the MultiAutoCompleteTextView comes down to whether or not the user should be allowed to input only "one item" as provided by the adapter, or "multiple items."
So for example, if you were writing an email app, and you wanted the "To:" field to be an autocomplete field, pulling matches from an address book, chances are you want to allow the user to pick multiple recipients for a message, and would make this field a MultiAutoCompleteTextView.
On the other hand, the "From:" field in the same example email app, you would need to enforce only a single selection by the user from their configured email accounts. And so an AutoCompleteTextView would be appropriate here.
Difference between AutoCompleteTextView and MultiAutoCompleteTextView
AutoCompleteTextView Vs MultiAutoCompleteTextView
AutocompleteTextView only offers suggestions about the whole sentence MultiAutoCompleteTextView offers suggestions for every token in the sentence. You can specify what is the delimiter between tokens.
AutoCompleteTextView is used for selecting single Item MultiAutoCompleteTextView is used for for selecting multiple Items by using a delimiter(such as comma) in betwwen them.
the “From:” field in example of email app, you would need to enforce only a single selection by the user from their configured email accounts. If you were writing an email app, and you wanted the “To:” field to be an autocomplete field, getting matches from an address book, chances you want to allow the user to pick multiple recipients for a message, and would make this field a MultiAutoCompleteTextView
AutocompleteTextView only offers suggestions about the whole
sentence
MultiAutoCompleteTextView offers suggestions for every token in the
sentence.
You can specify what is the delimiter between tokens also set the first or any no. of characters using setThreshold() with MultiAutoCompeleteTextView control in Android.