0

I need to enter a location for a survey. The location consists of a sub place(s) name and a main place name. An example is Paris (Sub place) and France (main place).

The sub place and main place options are represented in two AutoCompleteTextView views. The requirements are that if I select a sub place first the main place is automatically filled in. If I select a main place first the available options in the sub place is filtered to only includes sub places linked to the main place selected. Example for main place France, sub place will filter options to Paris, Marseille, Lyon etc.

What kind of data structure should I use for a list of 20000 items each with a sub and main place? It is one to many data set.

  • How do I change the available items in an AutoCompleteTextView dependent on the input of another AutoCompleteTextView?
  • How do I implement this kind of problem? I am already seeing load time issues when opening the Activity with 20000 odd items in an AutoCompleteTextView.

Any suggestions please.

Chintan Rathod
  • 25,864
  • 13
  • 83
  • 93
Rynardt
  • 5,547
  • 7
  • 31
  • 43

1 Answers1

0

I don't think performance will be much of a problem. Just save the data in a database, which will provide you with the easiest way for your structure.

Even after the first letter of the main place is pressed, it already drastically reduces possibilities.

Going from sub place --> main place, you could put the treshhold before showing the option list a bit higher.

Stefan de Bruijn
  • 6,289
  • 2
  • 23
  • 31
  • How do I assign a sqllite database to an AutoCompleteTextView? – Rynardt Mar 12 '13 at 12:37
  • In the API demo's (in Eclipse new Android project --> Examples) there are multiple examples of AutoCompleteTextView which will use the Contact database with a cursor adapter. – Stefan de Bruijn Mar 12 '13 at 15:03