My app uses data from a web server. On a website you can get autocomplete using some ajax calls which takes milli seconds to function. but in case of android i need to get all the key words from the site, store them in an array, make n adapter and set it to the AutoCompleteTextView. the problem is i have some 10K keywords on the server, so fetching such a huge data is a problem. So is there any other way to achieve autocomplete in my case?? thank you
Share
You are clearly going to have to prefetch the data in a non-UI thread so as not to ANR the app, and make it accessible in the form of some sort of local cache or service so as not to fetch the same data repeatedly.
Options in order of least complex to most complex:
AsyncTaskand store the results in a static variable of some sort.AsyncTaskor similar concept like in (1), but store the results in a cache, like those found in Guava: http://code.google.com/p/guava-libraries/wiki/CachesExplained