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. 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
(http://pastebin.ca/1705719), and it shows the crash happening because
TextView is calling SpannableStringBuilder#subSequence with a bad
range.

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: http://min.ie/2tF, src: http://min.ie/2tG)
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?)

Hi,

  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?

  JavaScript?

Cheers,
Mariano

-- 

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