1

I want to save this:

private Drawable icon; icon = pk.getApplicationIcon(procInfos.get(1).processName);

I get the icon then i want to save it in the resource folder. Thanks in advance.

willwo
  • 21
  • 4
  • It's not possibile. See also: http://stackoverflow.com/questions/5469954/android-image-save-to-res-drawable-folder – rciovati Jul 30 '12 at 18:58

2 Answers2

2

Resources are read-only at runtime; you cannot "save" anything "in the resource folder". You are welcome to save data to internal or external storage.

In this case, I doubt you should even be doing that, as those icons are meant to be read on the fly from PackageManager, not stored. After all, not only will those icons change as apps get updated, but you do not have rights to those icons.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
1

If you want to save a static file in your application at compile time, save the file in your project res/raw/ directory. You can open it with openRawResource(), passing the R.raw.<filename> resource ID. This method returns an InputStream that you can use to read the file (but you cannot write to the original file). You Can save images dynamically in sqlite database here is a tutorial on it. You can't save the image at Runtime in application folders.

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
Sunny
  • 14,522
  • 15
  • 84
  • 129