bhaskarc
bhaskarc

Reputation: 9541

Getting String Based Image Location from Drawable Directory

I am trying to use PDFjet library to print a page to PDF in Android.

The documentation tells me that in order to print an image to PDF, I need to get a handle on the image filename like:

String fileName = "images/myimage.png";

So now i want to print an image from the res/drawable folder. In Android the resources are referenced through R.id which returns an int.

My question is:

How do i get a handle on the image from the drawable folder as string ?

Upvotes: 0

Views: 603

Answers (1)

SaDeGH_F
SaDeGH_F

Reputation: 481

try this:

String fileName = "android.resource://your.package.name/" + R.drawable.xxx;;

Upvotes: 2

Related Questions