I am trying to get the list of all predictive words based on user input I am using android Softkeyboard sample any idea how should I move on
Regards
Saurabh
Store all the words in a SQLite databse.Thenfor each keypress look for word in database starting with composing text through cursor using like statement and store them in a list. Show this list to the candidate view and you are done :)
Related
I want to show suggestions not only as starting character but also a containing character... means 's' suggestions should be like tags,pas,also, and so on.
#sagar jagdale :
You can use Android AutoCompleteTextView.
It provides suggestions automatically when the user is typing. The list of suggestions is displayed in a drop down menu from which the user can choose an item to replace the content of the edit box with.
Check Demo Android AutoCompleteTextView Example
Even a Snippet of an android code to Integrate Google Search into an Edit text will be really useful, according to my requirement i don't want the google search data or whatever but only the dropdown so that it will b easier for people to type and don't have to waste time :)
You can see about the componenent is AutoCompleteTextView
An editable text view that shows completion suggestions automatically while the user is typing. The list of suggestions is displayed in a drop down menu from which the user can choose an item to replace the content of the edit box with.
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.
I would like to create a book reader and for this i have a problem of selecting some text and i don't know what is the best way. I read some posts in which they where using EditText for selection. But this is not so usefull because when you long tap it shows select word/select all and the keyboard appears, what i want is only the possibility to select text, listen the selection and then using Spannable/Linkify to edit that portion of text.
If there is no easy thing to use the standard text cursor controllers, can i create a custom cursor controllers or something like that ?
I read this posts:
Select text from TextView?
How to allow the user to select a text range in a TextView (Similar to EditText)
Thank you in advance.
Update:
I found this class android.text.Selection that seems to use the cursor controllers But i don't find any examples on google about it.
Use android:textIsSelectable="true" on your TextView.
I'm made a custom TextView with selection capability by studying Android's source code.
Please see my answer from the other question Android- How can I show text selection on textview?
Is it possible to create a custom dictionary for an edittext? In other words, can I create a custom list and have the edittext only suggest names from that list? I don't need it popping up useless word suggestions when the user is inputting specific names of people.
Please refer to this link.
https://developer.android.com/resources/samples/SearchableDictionary/index.html
They would have implemented content provider to provide a custom input to the quicksearch. You can try taking a similar approach where in you can make a query and update the result when a user enters each alphabet in your EditText box.
Use AutoCompleteTextView and provide your dictionary in the adapter.
http://developer.android.com/guide/topics/ui/controls/text.html