Autocomplete Textview - select only particular text rather than entire - android

Suppose, A autocompletetextview will provide multiple text data out of which, i want to display particular text only in autocompletetextview by discarding other data.
Example:
Textview options are:
goog - Google Inc
yhoo - Yahoo
msft - Microsoft Corporation
if user select the first one, the autocompletetextview should contain only goog.
I've no idea..how do i begin. Please can u explain me with one example.

I guess you could set this up with a structure as key/value.
goog will be the key, and goog - Google Inc yhoo - Yahoo msft - Microsoft Corporation the value.
In either a database, or a suitable Collection you'd be simply able to find the other, no matter if you provide the key or the value.

Related

Comparing text from speech to a child name in firebase with android

Brief description of the App:
The user click on a button that will trigger the Speech to Text API (google API). The text from speech is compared to some children in firebase. The comparsion is to the name of the child (not the value of the child). If the text from speech is like one of the children it sets the value of the this child to 1.
For example, My firebase:
numbers
three:0
four:0
five:0
If the user says three it will set the value "1" to three's value.
The problem is that the result of google speech to text Api gives more than one word(For example, if the user says three it returns: 3 tree three), and there is no LIKE clause in firebase
So how can I compare between the text from speech to the child name in firebase?
I would add my code but I think I'm far from the right answer.
Thank you very much (I hope you understand the question).

RealTimeDataBase shows different text depending on language device Android

Is it possible to use RealTimeDataBase from google to set content depending on the device's language?
Right now I have a different string.xml for this, but I would like to show this content with help from database from google.
For example, in a description of main screen shows content in English for english users, in russian for russians and so on, but taking this info from RealTimeDataBase, anyone knows how to do it?
You may store your content under the language node in the database. For example:
- English:
- - content1
- - content2
- French:
- - content1
- - content2
So you can get the device language and query the database with that parameter for the child. But you should handle the case where you don't have the content in the device's language.

emoji look up table and algorithm

I am trying to build an android app that the user can enter a string, and a list emoji related to that string would show up. (Just like Venmo app) For example:
case 1: User enters "pizz", and in the list there would be "πŸ•", note that the users enter "pizz", not pizza!
case 2: User enters "rabb", and in the list there would be "πŸ‡" and "🐰", note that the users enter "rabb", not rabbit!
What would be a good data structure and algorithm for this problem?
A trie is what your looking for. From Wikipedia
A trie, also called digital tree and sometimes radix tree or prefix tree (as they can be searched by prefixes), is a kind of search treeβ€”an ordered tree data structure ...
A trie is similar to a HashMap<K,V>, you can perform a lookup with keys and get a value. The difference is that you can also search by prefix. Given a prefix, it will find all the key-value pairs in the structure that have that prefix. It's basically the data structure for generating search suggestions.
General Idea:
Trie<String, String> t = new Trie<String, String>();
t.insert("pizza", "πŸ•");
t.insert("rabbit1", "πŸ‡");
t.insert("rabbit2", "🐰");
// then later...
t.findByPrefix("rabb"); // [πŸ‡,🐰]
Unfortunately, tries are too generic and are not present in any popular data structure libraries (like Java Collections Framework or Google Guava, for example). You'd have to implement one yourself or find an existing implementation and modify it.
I'd recommend:
Learning the theory. Watch this video. There are many more on YouTube that will teach you the basics. You can also search google for "N-way trie" and read notes about it.
Taking this class TrieST and modifying it. It's very similar (or already perfect) for what you need: http://algs4.cs.princeton.edu/52trie/TrieST.java.html see specifically thekeysWithPrefix method.

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

Check words from database

i am new to android development,so dint get me wrong. I am developing an application in which a text is generated.which is normally a word. The word is checked in a database for is corresponding value pair. Here the word is the key and its corresponding value is the value .
Since the text is auto generated it sometimes goes wrong(mis spelled). How do i perform a check of auto generated word to match with the mostly matched letters in the database of key word.
example: auto-generated word(key) - value
americ:
america : a country
Here the auto generatd word is americ(key) is not matched since it only contains america in its pair set.it need to be corrected as america.
You are probably using SQLite. Your best bet is soundex, which is desribed here.
Soundex has many shortcomings, but it might get you started. If you want a real measure, then go with Levenshtein distance, which is not built into the database (as far as I know).

Categories

Resources