How to create mention edit text like facebook - android

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.

Related

Programming in Android Studio to able the user to give three numbers and save them

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.

Registered user check for lowercase or uppercase

I want to know how to check the existing users for either upper or lowercase when a new user is signing up. At present for example the followig two users can be registered
tom and Tom, both of these are considered as two separate users, so if this happens I want to sound off to the user that the username already exists. Where in code exactly can I do this?
You can create a textwatcher for the edittext where user enters loginname and when focus changes from the edittext get the string in there using getText and pass this to an api which will check the username with db to check for similarity and will return a status false if similar user exits and you can show a red underline or red hidden badge to side of the edittext on the basis of this result to notify the user that such a username already exists.

Android - how to create custom word dictionary for only my application?

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 !!!

Android App , add a favorite quote functionality

I have an android app which displays quotes and have navigation to go to next quote and so on. would like to add "Save Quote As favourite" based on users selection of particular quote.
Once user saves Fav quotes and wants to see those quotes only, app should show those quotes.
Currently app reads the quotes from XML file. Let me know if any more information is required to understand the problem.
I would provide every quote with an ID (int). Whenever the user selects a quote to be a favourite, that ID is saved to a Set of integers. Later on if user decides to show favourites, you fetch all quotes with your IDs from the Set and show them in a appropriate view, for example a ListView
If you have a Quote class or something like that, you might as well put them in a collection whenever user decide his favourites, and show them in a ListView with a custom adapter.

How can I check an EditTextPreference value before the User validate it?

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.

Categories

Resources