I am trying to design a application for android in which, I have stored all the contacts of the phone in SQLite database and i want that the suggestion in AutoCompleteTextView
should be filled from the database. Please tell me how can i achieve my target?
Asked
Active
Viewed 2,109 times
0

android_newbie
- 667
- 2
- 14
- 32
-
Where did you get stuck? – user Nov 19 '12 at 06:56
3 Answers
2
Get an instance of CursorAdapter
, then set it as the adapter of your AutoCompleteTextView
.

cycDroid
- 915
- 10
- 16
2
use this to bind array to AutoCompleteTextView..you first get the values from sqlitedatabase and store in to String Array..
myAutoComplete.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, item));

Mehul Ranpara
- 4,245
- 2
- 26
- 39
1
You just have to bind your array of data which you are getting from the database to autocomplete like this-
AutoCompletetext.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, data));

Ravi
- 2,277
- 3
- 22
- 37