Android: databinding when using a ArrayAdapter: possible?
Posted
by Peterdk
on Stack Overflow
See other posts from Stack Overflow
or by Peterdk
Published on 2010-04-19T15:38:34Z
Indexed on
2010/04/19
16:13 UTC
Read the original article
Hit count: 586
android
|databinding
I need some simple databinding for a Spinner. I want to display 2 items for each dropdownitem.
So when the user clicks the spinner I get a list like:
-------------------
Name
123456
-------------------
Name
123456
-------------------
I understand this can be done when using a Cursor, according to the databinding info on android dev. Like:
SimpleCursorAdapter adapter2 = new SimpleCursorAdapter(this,
R.layout.my_custom_spinner_item_layout,
cur,
new String[] {People.NAME, People.ID},
new int[] {android.R.id.text1, android.R.id.text2});
However, I don't get my data from a database, so I don't use a cursor, I use a ArrayAdapter. Unfortunately it looks like there is no support for databinding with this adapter.
Is there a way to do this?
© Stack Overflow or respective owner