Hi Mark,
thanks for your response, I was hoping to catch your attention ;).

I know and am inheriting ArrayAdapter and overriding getView().

May be I should rephrase my question.

I know how to put it all together from the UI side. I know how to
populate the list view.

What I don't know is how to describe data that will be used to
populate the list view. I want the data to be described in XML
resource.

For example, if my list item only had one TextView in it, i.e. I only
need to display item title I would use <string-array> as a resource,
inflate it in my code and feed it to ArrayAdapter.
The thing is that I want three pieces of data per item. One ugly way
of doing it would be to have two string arrays defined in resources
and one typed array. String arrays would be for title and summary and
typed array would be for icons. But that's ugly and can go out of sync
quickly.

I'm now thinking of defining just my own plain XML resource and use
Resources.getXml() to get XmlResourceParser and parse it myself. The
question is, if my xml looks something like this:

<item icon="@drawable/myIco" title="foo" summary="bar" />

how do I access that @drawable/myIco resource (not the icon attribute)
while parsing the XML?

Thanks.

On Aug 8, 5:41 pm, Mark Murphy <[email protected]> wrote:
> On Sun, Aug 8, 2010 at 8:00 PM, gnugu <[email protected]> wrote:
> > as I stated in my original post I already have created custom layout
> > with and ImageView and two TextViews.
>
> > The question at hand is:
> > How do I populate a ListView, that has a custom list item as defined
> > above, from XML resource?
>
> > I.e.: Having a custom layout with ImageView and two TextViews, how can
> > I define the content in XML resource?
>
> If you are using ArrayAdapter, you will need to create a subclass and
> override getView():
>
> http://stackoverflow.com/questions/3436322/multiple-icons-in-android-...
>
> If you are using SimpleCursorAdapter, you can use a ViewBinder, or
> subclass the adapter and override setViewImage(), or subclass the
> adapter and override newView() and bindView().
>
> And so on.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to Android Development_ Version 3.1 Available!

-- 
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

Reply via email to