How to use drawable resource in custom XML?

by Robi » Thu, 10 Sep 2009 06:14:58 GMT

Sponsored Links
 Hey guys,

so I have an XML file: xml/catalog.xml
which contains gallery and pictures.

Like this:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
        <catalog xmlns:myres="" ;>
                <gallery title="@string/gallery01" 
                        <picture thumbnail="@drawable/pic_01">
                        <picture thumbnail="@drawable/pic_02">
                        <picture thumbnail="@drawable/pic_03">

In my view I can extract the attribute values using getAttributeValue
() in XmlPullParser, and the result is a string.
But could I somehow get the drawable resource right away? (That's why
I put the @ in the beginning)

getAttributeNameResource() gives null so that ain't good.

Any ideas?


Other Threads

1. Reproducable FC - bug in textview?

Users of Droid/Milestone are reporting a crash in my app, which is
reproducable for them. The crash happens when they use the app in
landscape with the virtual keyboard. I've managed to get stack traces
(, and it shows the crash happening because
TextView is calling SpannableStringBuilder#subSequence with a bad

I've been unable to reproduce the problem on a 2.0(.1) emulator (I
don't have a droid device), but they can reproduce it every time. I
wrote a small dummy app (apk:, src:
to see if it happens again, and it did, with the same stack trace.

Any ideas on how to work around this?


2. Scaling images in WebView (interactively?)


  I use WebView a lot to display web pages with embedded images.

  Some of those web pages contain images that are too large (dimensions) to
display them on the screen without scrolling. So I would like to
resize/scale those images so that they fit.

  I would be happy with any solution at all, but I would prefer one that
would take into account orientation changes. And on top of that it would be
awesome if a tap on the image would show the actual size of the image.

  Any ideas?




3. How to get the WebView UserAgent (without having a Context)

4. How to get the WebView UserAgent (without having a Context)

5. How to get the WebView UserAgent (without having a Context)

6. WebView "web page not available" after running awhile:

7. Adding Custom Data Types to Contacts