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. Provide a database packaged with the .APK file or host it separately on a website?

I've seen 3-4 different people ask some variation of this question in
these forums.  It seems like a very common question/need.
I'd like to see this specific topic addressed in part of the Dev
Guide, with various uses cases and proper solutions.

Pankaj, regarding your specific application:

Approach 2 sounds more sensible because the application is decoupled
from the data.
You could change the data without affecting the application, and vice
You could even take this modular approach a step further and allow
installation of pluggable, multiple databases.
For example, maybe db1 has Bible verses, db2 has Chinese fortunes, db3
has funny movie quotes, etc.
People could choose to install only the database(s) that they care
(With approach 1, you would have to include all databases in the apk
file, which could become cumbersome.)

My two cents.  :)
-- PJ

On Oct 29, 1:34am, "Pankaj Godbole [Andruid]" <>


2. Start app from browser

Hey there

I need to start an app from the browser on my android-phone (on my own

Is that posible (what to do)?



3. Is it possible to display the ExpandableListView indicator in right side?

4. Intents and navigating the GUI

5. Creating new Parceables

6. Anyone know what happened to Cyrket?

7. Put some image on background of a row of a ListView