tags:

views:

62

answers:

1

Hello. I want to do the following:

I want to make a very simple gallery application. So I'd like to select a path for the images and set it as a resource. I set it in String.xml.

So I have another class, which needs the selected path to load all the images from it.

class ImageHolder
{
     public ImageHolder()
    {
    this(R.string.image_dir);
    //problem is here - R.string.image_dir returns a unique int, while what I really need is the string. How can I get it...
    }
    public ImageHolder(String path)
    {
    .........standart procedure.....
    }
}
+3  A: 

Use getString(resID) but you'll need a Context Object though.

It's a Function of Context, so within an Activity you can write this.getString(R.string.image_dir); or you can skip this altogether...

st0le
Exactly what I was looking for. Thanks! Should have crossed my own mind, though...
George