I am developing one android app for ice cream sandwich I want to populate a dialog box containing list items(only one column) from database, on edit Text click, but list should get filter according to the text change in edit text. is that possible ?? Till now i am able to populate Dialog box containing all list items but i have no clue to filter this list according to edit text, this will work just like a search bar.
Asked
Active
Viewed 369 times
0
-
when dialog box appears on clicking edittext, then u wont b able to enter anything in edittext as all UI behind dialog box is un-accessible until n unless dialog box disappers – Braj Feb 15 '13 at 07:18
-
Thank you for response braj, but I am setting the position on dialog box, so edit text is visible. – UdiT Feb 15 '13 at 09:48
-
yes, its possible. Edittext has got listener for text change... based on that changed text u could query database for matching elements, fetching them and displaying in dialog box listview... – Braj Feb 15 '13 at 13:21
-
Thank you braj, i will try , i think it is the answer. – UdiT Feb 15 '13 at 13:41
-
u r welcome... wow wow wait wait, I wl post that as answer so that i can get some reputation ;) – Braj Feb 15 '13 at 13:46
-
sure braj :) , but i tried it in the same way then,, i am facing one issue, that is , whenever i change text in edit text.. again it popups the dialog box with updated list.. and hide soft keyboard for edit text, which is very annoying, can i change the text continuously and update dialog box list simultaneously?? – UdiT Feb 16 '13 at 07:10
-
could u post that code? – Braj Feb 16 '13 at 14:30
1 Answers
0
The thing that you are looking for can be accomplished using AutoCompleteTextView in android. It poulates a dialog everytime you enter letters in textfield.The Prdictions come from an ArrayList containing list of items.Also as you said you can fetch list of items from database and put the items in arrayList from which predictions are displayed.
Here is one example according your need.
http://www.javatpoint.com/android-autocompletetextview-example
Integrate Sqlitedatabse code with example given on above link to fulfill your needs.

Jigar Pandya
- 2,129
- 2
- 17
- 27