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=" http://schemas.android.com/apk/res/android" ;>
                <gallery title="@string/gallery01" 
thumbnail="@drawable/t_gallery1">
                        <picture thumbnail="@drawable/pic_01">
                        </picture>
                        <picture thumbnail="@drawable/pic_02">
                        </picture>
                        <picture thumbnail="@drawable/pic_03">
                        </picture>
                </gallery>
        </catalog>

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
versa.
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
about.
(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]" <panka...@gmail.com>



-- 

2. Start app from browser

Hey there

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

Is that posible (what to do)?


Peter

-- 

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