How to populate second AutoCompleteTextView based on the first AutoCompleteTextView Selection

前端 未结 1 1684
误落风尘
误落风尘 2021-01-26 06:50

I have 2 AutoCompleteTextViews in my android app which are loading data from the server. The first one loads Manufacturer name and the second one has to load the mo

相关标签:
1条回答
  • 2021-01-26 06:57

    I think SQLite is a key to solve your problem.

    There are several options:

    1. Store your manufacturer and model list in SQLite.
    2. Store your manufacturer and model list in SQLite. Update using HTTP request on app launch alongside with other data.
    3. Store your manufacturer and model list in SQLite. Update using HTTP request on manufacturer select using timestamps to determine whether it really needs update.
    4. Update model list on manufacturer select using HTTP request.

    Decision

    • First option if your list of manufacturer and model is not regularly updated on the website and could be updated with the app itself.
    • Second and third are viable if the list is updated regularly and you have huge amounts of data to be updated on each request.
    • Fourth one is ok, but it highly relies on server availability and connection speed, which could cause usability issues.
    0 讨论(0)
提交回复
热议问题