6

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...

Jin35
  • 8,602
  • 3
  • 32
  • 52
Abramodj
  • 5,709
  • 9
  • 49
  • 75
  • 1
    just 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 Answers2

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:

Save bitmap to location

Community
  • 1
  • 1
Cristian
  • 198,401
  • 62
  • 356
  • 264
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