2014-01-08 29 views
0

我街道的建议列表autoCompleteTextView从简单光标适配器填充必须根据用户选择的城市进行更改。我试图使用功能:动态改变光标为autoCompleteTextView

((SimpleCursorAdapter((AutoCompleteTextView)activity.findViewById(R.id.street)).getAdapter()).swapCursor(cursor); 

((SimpleCursorAdapter((AutoCompleteTextView)activity.findViewById(R.id.street)).getAdapter()).changeCursor(cursor); 

((SimpleCursorAdapter)((AutoCompleteTextView)activity.findViewById(R.id.street)).getAdapter()).notifyDataSetChanged(); 

invalidate()但建议列表中仍然显示第一光标,而不是新的结果。

请帮我,我在想什么?

+0

如果您使用上下文来代替活动会发生什么? – Ari

+0

findViewById(int)未定义为类型上下文 – dvrm

+0

我相信这是一个单独的适配器类,所以您必须将活动上下文从您的活动传递到此适配器类,否则请调试您的代码并检查是否真的在传递新光标或仅第一个光标 – Ari

回答

0

我的错误是我更改了游标适配器的查询,但没有更改validator的查询。对不起假报警..