You should use XMLrpc to only retrieve a small number of cities, based on the characters that the user has already typed, like what "Google suggests" implements. trying to read 18000 entries from the server is not going to work or even be fast. trying to populate a spinner with 18000 entries is insane, not only is it bad UI but a waste of resources.
if you absolutely want to store the data on the device, you should consider a packed binary format that's amenable to lookups and serial access. I guess that a trie would be very appropriate here (see http://en.wikipedia.org/wiki/Trie) 2008/3/28 dr123 <[EMAIL PROTECTED]>: > > The database has around 2 million records. as a text file it's more > than half the disk space of the android. > > On 29 Μαρ, 01:12, Diego Pino <[EMAIL PROTECTED]> wrote: > > I think you should rather store your data on a local sqlite database, > > and access to it via a ContentProvider. > > > > You can use the method onKeyDown(int keyCode, KeyEvent event) to catch > > a key press event. You could then, query your data to retrieve a brief > > set of cities (set a LIMIT on your query) and populate the Spinner > > using and ArrayAdapter. Just an idea... > > > > On Mar 28, 11:05 pm, dr123 <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > i'm again the guy with the 8mb question. actually it's not 8mb it's a > > > little larger but here is my problem to which i can't get any > > > solution. > > > > > I need to have the user choose his country and then populate > > > "something" with all the cities of the country. > > > In order to be exact, i have a database with 18000 cities for greece > > > only for example. > > > Going through that kind of text or html file is not feasible as it > > > would have to take extreme space and memory. > > > > > I tried two solutions: > > > first one is having the database on my server and collecting the data > > > through xmlrpc. this fails cause the data is bigger than the > > > kxmlrpclitent can hold (or some other limitation but in the debugger > > > it only gets a couple of hundred cities or so). > > > > > the second one is better (i think): > > > i open up a php page on my server with webkit that has all the cities > > > and i can easily see them with a normal browser. > > > > > *BUT*: the android browser (at least the one that opens with a new > > > intent and a uri) > > > translates the html combobox into something like a spinner. this is > > > extremely slowly generated (i wait for minutes before it opens up and > > > have to press the button 2-3 times) and second and most important: > > > i can't find a way to press the "r" key for example and the box > > > transfers me to the first city which starts with "r". > > > Noone can scroll down a list with 18000 cities. > > > > > I know i should get something with less cities but first of all that's > > > the only database that has all the cities (i wouldn't want only the 10 > > > bigger cities cause in the united states for example that would also > > > be some thousands). > > > > > My app which is going for the challenge (i'm in a hurryyyyyyyy) is a > > > social app *depends* on good geographical selection (not gps , i > > > know). > > > > > any help *very* appreciated > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

