开发者

How can I get the value of an NumberPicker widget?

I am looking for a number picking like those used in the date controls on an Android and found this question: hour/minute picker for android countdown timer

Following that example I can get the controls I want - Yay! The problem is I don't see how to get the value the user selects? 开发者_如何学Go Normally I would set an on change listener and be happy, but how do I create a class that implements the internal interface com.android.internal.widget.NumberPicker$OnChangedListener? Is there another way to get the current selection?


Check the source code... Do you need a listener? getCurrent should give you the value. With reflection it would be something like:

Method m = c.getMethod("getCurrent");
int value = (Integer) m.invoke(o, foo);

EDIT: You can implement an interface that you got through reflection with java.lang.reflect.Proxy, see this question here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜