My app takes a photo from cam开发者_开发百科era and after some image processing operations I want to save it drawable file in android. It is possible ?
No, you can't.
You can store it into the internal memory. See the link for the details:
http://developer.android.com/guide/topics/data/data-storage.html#filesInternal
Why do you need it to be a resource of your app? You could save it to SD card or internal storage using Bitmap.compress(CompressFormat.PNG, 100, fileoutputStream);
Where fileoutputstream is obtained from something like:
String pathString = String.format("%s/%s/%s", Environment.getExternalStorageDirectory(),yourDirOnSD, yourFilename);
File path = new File(pathString);
path.mkdirs();
And then read it back in when you want using BitmapFactory.decodeFromFile();
Note that if the directory you use on SD starts with a period, it will be exempt from being scanned by the Android media scanner so items in it wont show up in the users photo gallery app, etc. If you want the photo to be visible to other apps, you should probably look into use MediaScanner to have it index your pic once save, otherwise it wont show up until the SD card id remounted.
精彩评论