0

I need to add images into res/drawable folder dynamically as the user select images of his choice from a server...then store the corresponding R.drawable.imageid to Database..so as to load the user chosen images on the next run...Is there no way to do so...?

int[] images = {
   R.drawable.m1,R.drawable.m2, R.drawable.m3,                      
   R.drawable.m4,R.drawable.m5, R.drawable.m6,
   R.drawable.m7, R.drawable.m8,
   R.drawable.m9
               };

ImageView iv = (ImageView)findViewById(imageViews[next]);
iv.setImageResource(images[j]);  

Here R.drawable.m1, R.drawable.m2, R.drawable.m3, R.drawable.m4, R.drawable.m5, R.drawable.m6, R.drawable.m7, R.drawable.m8, R.drawable.m9 should be ids of images chosen by user from the server

Ken White
  • 123,280
  • 14
  • 225
  • 444
rijinrv
  • 2,029
  • 2
  • 16
  • 17
  • 1
    Please don't SHOUT when you ask questions. It makes them harder to read. You also don't need the same info in the title you're putting into the tags, and it helps if you use real words ("the" instead of "d", "should" instead of "shd", and so forth); not all people who might offer you help are native English speakers (or understand the noises), and the clearer your question is the more likely you'll quickly get an answer. Thanks. :) – Ken White Feb 06 '12 at 15:43

2 Answers2

0

u cannot copy the images in drawable folder.

create folder in data folder and write images there and use bitmap class to map the image.

SathishBabu S
  • 382
  • 3
  • 11
0

Quoting Android Engineer RomainGuy

You cannot write to res/drawable.

However you can look for other alternatives like external storage.

Links to consider are

android image save to res/drawable folder

How to convert a Drawable to a Bitmap?

Android: Image save to location

Community
  • 1
  • 1
Adil Soomro
  • 37,609
  • 9
  • 103
  • 153