我在活动一微调控件,它可以让用户选择一个列表名称。
I have a spinner widget in my activity which lets users pick a list name.
通常情况下,微调的作用是列表之间,但一对夫妇的实例进行切换,我换出的选择改变监听器与选择相同的列表执行不同的功能。一旦选择完毕,旧的监听被恢复,生活还要继续。
Normally, the function of the spinner is to switch between lists but for a couple of instances, I swap out the selection change listener to perform a different function with the same list of options. Once the selection has been made, the old listener is restored and life goes on.
这是一个坏的和马车的安排。相反,我想有一个函数,只是需要选择监听器和其他一些参数,并显示这些受相同的游标填充(或和相同的光标)作为微调弹出列表,而无需使用微调本身。
This is a bad and buggy arrangement. Instead, I would like to have a function that just takes a selection listener and some other parameters and shows a popup list that's populated by the same cursor (or and identical cursor) as the spinner, without using the spinner itself.
有没有什么办法可以做到这一点?
Is there any way I can do this?
推荐答案
使用 AlertDialog.Builder
并提供一个适配器
通过 setAdapter()
生成的行。
Use AlertDialog.Builder
and supply an Adapter
via setAdapter()
that generates your rows.
在你的情况,我也不会使用相同的光标
,作为光标
具有的固有的观念当前行,并用光标,搞乱
,而它是由您的 SpinnerAdapter
可能搞砸了微调
。去用相同的光标
。
In your case, I would not use the same Cursor
, as a Cursor
has an intrinsic notion of the current row, and so messing with the Cursor
while it is used by your SpinnerAdapter
could screw up the Spinner
. Go with an identical Cursor
.
相关推荐
最新文章