Reputation: 311
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
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