当前位置: 动力学知识库 > 问答 > 编程问答 >

Android - Add typed objects to spinner widget

问题描述:

I have a Website class that has 3 get,set properties ID, Name, URL.

For other hand i have a method that gets from database websites, and return a List

I would like to bind this List into a Spinner.

My questions are two:

  • Its possible to add these websites list into a Spinner ?

  • As my website class has the property ID and Name, is possible that after a item of the spinner is selected, have the ID and Name of the item website selected ?

Thanks a lot in advance.

Best Regards.

Jose.

网友答案:

You can subclass CursorAdapter that will query db for the websites and set it via yourSpinner.setAdapter(..).

分享给朋友:
您可能感兴趣的文章:
随机阅读: