android - 将可绘制文件夹中的图像添加到创建的文件目录中

android - add images from drawable folder into a created file directory

我希望能够拍摄存储在我的应用程序可绘制文件夹和 copy/save 将它们复制到我的应用程序启动时创建的文件目录中。
我已经尝试 .createnewfile() 但无法正常工作。

代码在下面创建我的文件目录:

//-----create file directory for images
public void createDirectory() {

    try {

        File imageDirectory = new File(Environment.getExternalStorageDirectory() + "/DCIM/C2AT_IMAGES");

        if (!imageDirectory.exists()) {

            imageDirectory.mkdirs();

            //something here to take images from drawable folder and place them into my newely created directory

            File imageFile = new File(Environment.getExternalStorageDirectory() + "/DCIM/C2AT_IMAGES", //something here getDrawable maybe?
                    );
            imageFile.createNewFile();


        }

    }

    catch (Exception e) {

        Log.d("MAKE_DIR", "error creating directory");

    }

}

谢谢

已解决,我是这样做的:

Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.maptile_1);

                ByteArrayOutputStream bytes = new ByteArrayOutputStream();
                bitmap.compress(Bitmap.CompressFormat.JPEG, 40, bytes);

                File f = new File(Environment.getExternalStorageDirectory() + "/DCIM/C2AT_IMAGES"
                        + File.separator + "test.jpg");
                try {
                    f.createNewFile();
                    FileOutputStream fo = new FileOutputStream(f);
                    fo.write(bytes.toByteArray());
                    fo.close();
                } catch (IOException e) {
                    e.printStackTrace();

                    toastMsg = e.toString();
                    toast();
                }