Jaffar Raza
Jaffar Raza

Reputation: 311

getting string image path placed in drawable folder

Is it possible to get the path of an image in string form in android like

res/drawable/image.png

Or is their any other way for getting string path of an image that is placed in drawable.

Upvotes: 0

Views: 10665

Answers (2)

Johannes Staehlin
Johannes Staehlin

Reputation: 3720

No, it is not.

Drawable drawable = this.getResources().getDrawable(R.drawable.ic_launcher);

e.g. will give you the default launcher icon. It is not possible to get the exact path for an image , that is stored in drawable.

Why not? When you compile your app to an *.apk file, all resources (ok, except from them in /raw) are compiled as well. You can only acces them, using their R. id.

Solution? Not really, you could copy them to a location on the sd card for example. Now you know the location :)

Upvotes: 2

Mallu Don
Mallu Don

Reputation: 112

its not possible to get path of drawable image directly , but you can get this by storing it in internal memory or sdcard of device.For this i have written blog.. check out the link here

i am sure it will help you.

Upvotes: 2

Related Questions