Auto Complete Textview - android

Is there a way to set the format of AutoCompleteTextview like cellphone number with dashes?
I have an AutoCompleteTextview with custom adapter that suggests account numbers from sqlite table and it shows like this.
but when i click the suggested account number I want it to look like phone number format and make it like 110-0011. Is that possible for AutoCompleteTextview?

Related

Using MultiAutoCompleteTextview which stores ids

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.

android how to search contacts by input strings and display results in scrollable list like in the sms messages

I want to implement contacts search like we have in the build in SMS messages app, when you have a text box to enter the contact name and for each letter you insert , a scrollable list of contacts which thier name starts with the input text is displayed on screen, right under the text box. If you delete all input or can't find sutable contact then the list disappear.
When the user selects one of the list items then its full name is written in the text box.
What controls should I use to implement this behaviour? Would EditText and a regular ListView will do?
I couldn't find examples...
Please help, thanks
You can use addTextChangeListener in your EditText and search value from your listview.
This link can help you.

How to display word dictionary with custom keypad in android

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.

Android How can I create phone number edittext

my problem is creating EditText for phone numbers on Android.
I want to create EditText and when user entering phone number or letters, suggestions open drop-down list, like this:
How can I do this?
You need to use AutoCompleteTextView in your layout and then have a look at
http://developer.android.com/reference/android/widget/AutoCompleteTextView.html
and then
http://developer.android.com/training/contacts-provider/retrieve-names.html
In Graphic Layout, rightclick on edittext, in InputType menu, select any number type - number, phonetic
When you will run the app, the on screen keyboard will show only numbers
Its possible to supply phone numbers or contact names as adapter to auto complete text view.
The below link provides you a tutorial to achieve this requirement.
Fetch Phone contacts and Show it in AutoComplete TextView in Android

Android add custom search bar in application

I want to implement search bar in my application which will filter list view depending on letters entered in edit text. Here is what I have actually like a design
So I want to filter the elements by title so I guess I have to change the sqlite statement, because I'm populating the listview from database.
And I have two question :
1.Which is the best way to implement custom search bar : add textwatcher to an edit text and change the sqlite statement everytime user enter letter or ?
2.How to sort in sqlite depending on letters entered from user. If user press A I want to show all items which have that letter no matter if it's in the beginning or in the end.
So the things to achieve this are very simple, no matter what kind of Adapter are you using. First you need to create TextWatcher and add it to your Edit Text. Than in your onAfterTextChanged() you can create your new SQL statement like :
String sql = "SELECT title FROM cards WHERE title LIKE '%"+someString+"%'"
//where someString is `Charsequence` which you get in your onAfterTextChanged()
Before getting your data again if you are using ArrayList or any other kind of Lists for storing your data you have to clear them, so you can get the new data. And than you can simply call adapter.notifySetDataChanged(). And it should work. At least this is the way how I'm doing this. Maybe it's not the best way, but it's working.
What is the size of your database? if it is not a BIG one then i think the simple SQL should work for you:
SELECT Column1, Column2
FROM myTable
WHERE myColumn LIKE 'somecharacter%'
You can call to DB while the user is typing or can use some other logic like when the user press a specific button.

Categories

Resources