elzee wrote:
> How can I
> format these fields before placing them into my listview?
>
> private static int[] TO = { R.id.from, R.id.body, R.id.date, };
> private static String[] FROMTWO = { FROM, BODY, DATE, };
>
> SimpleCursorAdapter adapter;
> adapter = new SimpleCursorAdapter(this,R.layout.item, c, FROMTWO, TO);
> setListAdapter(adapter);
Subclass SimpleCursorAdapter and override newView() and bindView(). You
can either:
1. Chain upward to the superclass implementations (which will do what it
is doing today), then fix up the things that need formatting, or
2. Inflate the row Views and populate them all yourself, which is more
efficient but requires more code
http://wiki.andmob.org/samplecode
On the above Web page, you will find links my Fancy ListViews blog post
series. It covers overriding getView() instead of newView() and
bindView(), but the concepts are basically the same.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
Android App Developer Books: http://commonsware.com/books.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---