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