Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android将图片保存到drawable_Android - Fatal编程技术网

Android将图片保存到drawable

Android将图片保存到drawable,android,Android,我编写了一个小程序来裁剪存储在drawable文件夹中的图像。我不知道如何将裁剪后的图像保存到drawable文件夹 这是我在看到另一个stackoverflow帖子后尝试的 try { FileOutputStream out = new FileOutputStream("/res/drawable/test2.png"); bMap.compress(Bitmap.CompressFormat.PNG, 90, out); } catch (Exc

我编写了一个小程序来裁剪存储在drawable文件夹中的图像。我不知道如何将裁剪后的图像保存到drawable文件夹

这是我在看到另一个stackoverflow帖子后尝试的

try {
        FileOutputStream out = new FileOutputStream("/res/drawable/test2.png");
        bMap.compress(Bitmap.CompressFormat.PNG, 90, out);
     } catch (Exception e) {
        e.printStackTrace();
     }
其中bMap是位图对象

我不知道如何将裁剪后的图像保存到drawable文件夹


您不能“将裁剪的图像保存到可绘制文件夹”。资源在运行时不可修改。请将其存储到其他地方(
getFilesDir()
等)。

哦,好的。。我可以用任何方式将图像保存到某个位置,然后在program exec之后将其移动到drawable文件夹,以便下次应用程序运行时,我可以打开裁剪后的图像???@Aado Droid:不。只需从保存图像的文件中打开即可。