In my app, I want to use a MultiAutoCompleteTextview to get an effect like Facebook mentioning. After I type '#', I want to get a dropdown list from which to select a person. This will show the person's name in the MACTextView.
"Went to the cinema with John Doe"(What the user sees)-> "Went to the cinema with
[person:245]"(What I need to store)
How can I accomplish this? I know how to query my database and how to use the MultiAutoCompleteTextview. I just need help with differentiating between what's shown and what's stored.
I solved this by using Linkedin's spyglass library. This provides a mention edittext which is very customizable. It works by setting spans for the mentions. When saving, I used getSpan() and replaced the spans with my tags.
Related
I'm building an app with linear and relative layouts to create lists. I want to have a search function to search through text fields and return the results with "links" to the pages it pulls the results from.
I don't know if I am explaining this well enough, but that's what I need help with. I can find all sorts of search help but it all seems to revert back to ListView's.
You should aim to create your "lists" from some form of data-store. Usually a database, see SQLite Databases in Android. You should then use the query language to return only fields that match your search term e.g. "SELECT * FROM people WHERE name = 'Adam'".
To directly answer your question, the searching of text fields (EditText's or TextViews) is not possible to do automatically and you would need to hard code the search for each individual one.
I am looking to achieve the functionality of an AutocompleteTextView but slightly different. Instead of getting a drop-down list with suggestions i want it to complete the sentence for me.
For example: i type abc and i get completed, with the rest of the text in grey: abc1#etc.etc and then click a button to keep this text or keep writing to filter this even further.
Do you think is is achievable somehow?
I have looked my problem up so far but all the answers i found involved a drop-down list, perhaps i haven't looked deep enough.
Why don't you try to implement a custom view?
Basically, you need to the same things that the AutoCompleteTextView does but instead of displaying N elements into the drop down list you have to add the first option to your EditText.
Have a look at:
TextWatcher in order to see how detect the user input and progress
You can then play with indexes and spannables in order to keep track of the data input by the user and the data that you are suggesting.
One thing that I don't like about this idea is the fact that if you have got:
Germans
Germany
...
You need to type a lot of letters without the possibility to choose something different from the solution that you are providing.
use below example ... i think help you...
http://teamandroid4u.blogspot.in/2012/06/autocompletetextview-example.html
I am developing an application where a list of words are shown..The list very big and user can select any one of the items in the list..I would like to provide search functionality where user can type in a keyword(part of the word) and a only matching items need to be displayed..Any idea of how to do this?
Well... the AutoCompleteTextView has been a part of the Android API since day 1... it does exactly what you need. You'll have to have your list items in some kind of adapter, but that shouldn't be too difficult to implement.
http://developer.android.com/reference/android/widget/AutoCompleteTextView.html
Edit - And indeed, look at Sanjay's post for a link to a tutorial on using it.
I am developing an Android App which gives users an option 'Browse Alphanumerically'. Using this option let users view the list of items starting with a particular letter or number. Problem is that I cannot decide how to implement screen for this, which can work properly on any screen size. Please suggest me the best solution.
Thanks.
What I got from your question is that you want to show all alphabets and numbers to the user so they can jump directly to a entries start with the selected alphabet or number. If this is so, then one solution to your problem is use the Button or ImageButton any make a key pad of all alphabet and numbers. Don't forget to make them flexible enough for different screen sizes. Cheers.
Use a list activity. There are lots of tutorials on Google's developer site. When you want to narrow the list, just assign the smaller list to the ListView. Just filter your master list, sort it, and assign it to your list adapter.
Hope this was helpful.
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