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()
但建议列表中仍然显示第一光标,而不是新的结果。
请帮我,我在想什么?
如果您使用上下文来代替活动会发生什么? – Ari
findViewById(int)未定义为类型上下文 – dvrm
我相信这是一个单独的适配器类,所以您必须将活动上下文从您的活动传递到此适配器类,否则请调试您的代码并检查是否真的在传递新光标或仅第一个光标 – Ari