-3

In my project I want to download an image from a URL, and I want to share the image through Kik Messenger. The code for sharing the image in Kik Messenger is:

KikMessage message = new KikMessage("com.kik.myapp.id");
message.setImage(this, R.drawable.something); 

So how can I store the image in the drawable folder?

Darshan Rivka Whittle
  • 32,989
  • 7
  • 91
  • 109
basanta
  • 1
  • 3
  • your apk is read Only you can't save files on it!! save your image on your SDcard – K_Anas Jul 02 '12 at 08:39
  • @K_Anas I'd think internal storage would make more sense than external... – Darshan Rivka Whittle Jul 02 '12 at 09:09
  • A quick search pulled up these two: http://stackoverflow.com/questions/3375166/android-drawable-images-from-url http://stackoverflow.com/questions/5469954/android-image-save-to-res-drawable-folder You should post your code, it will help with a solution. – Brain Monkey Jul 02 '12 at 08:29

1 Answers1

1

Your application resource directory is read-only, so you simply can't do that.

Your best bet is to see if Kik Messenger offers any methods that take a Drawable rather than a resource ID.

Update: I just checked the Kik Messenger docs, and there are indeed two other methods that set the image: setImage(BitmapDrawable) and setImage(File). The simplest option would probably be to save the image to internal storage and attach the file (and then delete it if you won't need it again).

Darshan Rivka Whittle
  • 32,989
  • 7
  • 91
  • 109