How can I add a Bitmap
taken from the web (in the app i mean!) to the drawable resources? So i can access the Bitmap
using R.drawable.bitmapName
...
Asked
Active
Viewed 1.2k times
6
-
1just move it into the drawable folder and eclipse should automatically generate the coresponding class entries in R.drawable...... – Erhard Dinhobl Dec 29 '10 at 15:12
-
I want to do it programmatically! The app starts and download the image from the web. I've done thiss step, but now how can i save it to R.drawable? – Abramodj Dec 29 '10 at 15:13
2 Answers
7
You can't modify that folder once your app is installed. In that case, you must copy the bitmap to a file and access it from there. Take a look at this other question:
-
I just wanted the bitmap to be in R.drawable so i could get its id as an int. Is there another way to get the id? – Abramodj Dec 29 '10 at 15:14
-
1
1
The resources are compiled at the apk building time, so you cannot change it in runtime. If you want to have some identifier you can consider creating a shared preference where you can put in relation the downloaded image file with some id. But it will take some effort from you to implement the functionality.

Vladimir Ivanov
- 42,730
- 18
- 77
- 103