Java Android AutoCompleteTextView运行非常缓慢
我有一个大约25万个字符串的列表,我将其提供给一个Java Android AutoCompleteTextView运行非常缓慢,java,android,autocompletetextview,Java,Android,Autocompletetextview,我有一个大约25万个字符串的列表,我将其提供给一个AutoCompleteTextView 当我将它们应用于视图时,建议弹出窗口大约需要10-20秒才能显示出来 由于所有的值都至少有10个字符长,我也尝试将阈值设置为5,但似乎没有多大帮助 我使用的代码是: List<String> locations = GetLocations(); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
AutoCompleteTextView
当我将它们应用于视图时,建议弹出窗口大约需要10-20秒才能显示出来
由于所有的值都至少有10个字符长,我也尝试将阈值设置为5,但似乎没有多大帮助
我使用的代码是:
List<String> locations = GetLocations();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, locations);
((AutoCompleteTextView) findViewById(R.id.txt_location)).setAdapter(adapter);
((AutoCompleteTextView) findViewById(R.id.txt_location)).setThreshold(5);
List locations=GetLocations();
ArrayAdapter=新的ArrayAdapter(这是android.R.layout.simple\u下拉列表\u项目\u 1行,位置);
((AutoCompleteTextView)findViewById(R.id.txt_位置)).setAdapter(适配器);
((AutoCompleteTextView)findViewById(R.id.txt_位置)).setThreshold(5);
有没有办法让这种行为更快,或者我错过了另一种处理这种情况的方法?
编辑:
现在我搜索了更多,似乎除了自己实现更好的逻辑之外没有其他选择()250000???哦,天哪,你是认真的吗?将所有数据放在sqlite db中,确保它有一个用于快速数据访问的索引,然后使用SimpleCorsOrAdapter作为ACTV适配器,这样你就可以使用全文搜索来搜索整个文档了谢谢,我会尝试的!