如何填充基于第一AutoCompleteTextView选择第二AutoCompleteTextView [英] How to populate second AutoCompleteTextView based on the first AutoCompleteTextView Selection

查看:151
本文介绍了如何填充基于第一AutoCompleteTextView选择第二AutoCompleteTextView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2 AutoCompleteTextViews 在我的Andr​​oid应用程序,它是从服务器加载数据。第一个负载厂家名称,第二个具有从所选的生产商加载模型

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 models from the chosen Manufacturer Name.

我看了一下<一href="https://stackoverflow.com/questions/16645536/to-update-the-second-autocompletetextview-based-on-the-value-of-the-first-one">to更新基于第一个的没有用的,我的价值,但它的,因为我有超过100家制造商nsame第二autocompletetextview。因此,我不希望使用IF statments 100年代,因为它是不好的编程习惯和code会乱码。我的导师建议我使用AJAX(不知道其支持Android和如果不是不知道如何实现它)。

I had a look at to update the second autocompletetextview based on the value of the first one but its of no use to me as I have more than 100 manufacturers nsame. Therefore, I don't want to use 100s of IF statments as it's bad programming practice and code will be messy. My supervisor suggested me to use AJAX (not sure if its supported by android and if it is not don't know how to implement it).

任何建议如何落实这个概念,或者它可以通过AJAX来完成,请告诉我一个教程或和榜样。谢谢!

Any suggestion how to implement that concept or if it can be done by AJAX, please tell me a tutorial or and example. Thanks!

推荐答案

我觉得SQLite是一个关键,解决你的问题。

I think SQLite is a key to solve your problem.

有几种选择:

  1. 在您的存储制造商和型号列表中的SQLite。
  2. 在您的存储制造商和型号列表中的SQLite。使用更新的HTTP 请求应用程序启动一起与其他数据。
  3. 在您的存储制造商和型号列表中的SQLite。使用更新的HTTP 对制造商的要求选择使用时间戳来确定是否 它真正需要的更新。
  4. 在厂家更新型号列表中选择使用HTTP请求。​​
  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.

的决定

  • 如果您的制造商和型号的列表不会定期更新的网站上,并能与应用程序本身进行更新第一个选项。
  • 在第二和第三个是可行的,如果该列表会定期更新,你有大量的数据需要更新的每个请求。
  • 在第四个是好的,但它高度依赖于服务器的可用性和连接速度,这可能会导致可用性问题。

这篇关于如何填充基于第一AutoCompleteTextView选择第二AutoCompleteTextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆