2

コピーしたい画像のパスを取得でき、コピーしたい場所からパスを取得できますが、それらをコピーする方法が見つかりません。なにか提案を?

private void copyPictureToFolder(String picturePath, String folderName)
            throws IOException {
        Log.d("debug", folderName);
        Log.d("debug", picturePath);

        try {
            FileInputStream fileInputStream = new FileInputStream(picturePath);
            FileOutputStream fileOutputStream = new FileOutputStream(folderName+"/");

            int bufferSize;
            byte[] bufffer = new byte[512];
            while ((bufferSize = fileInputStream.read(bufffer)) > 0) {
                fileOutputStream.write(bufffer, 0, bufferSize);
            }
            fileInputStream.close();
            fileOutputStream.close();
        } catch (Exception e) {
            Log.d("disaster","didnt work");
        }

    }

ありがとう。

4

1 に答える 1