Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android autocomplete EditText from server

I want to implement an Autocomplete mechanism for an EditText field, but the list of autocomplete comes from the server. I looked into AutoCompleteTextView but it only supports fixed strings by default.

I'm just talking about the UI. I'll be issuing a http request to my webserver and getting the JSON result back. When do I fire the request and how do I plug it into the UI?

like image 831
Saurav Shah Avatar asked May 01 '12 14:05

Saurav Shah


1 Answers

I think that you could use the AutoCompleteTextView, like in this example: http://developer.android.com/reference/android/widget/AutoCompleteTextView.html

...but in order to use your server, you'll have to tweak your Adapter. That's what it's for :)

**EDIT: ** Here's a nice example: How do I Use AutoCompleteTextView and populate it with data from a web API?

like image 194
Igor Deruga Avatar answered Oct 13 '22 20:10

Igor Deruga