この関数を使用して、いくつかの画像とビデオをカスタム フォルダーに移動しています。
public static void moveFile(File src, File dst) throws IOException {
FileChannel inChannel = new FileInputStream(src).getChannel();
FileChannel outChannel = new FileOutputStream(dst).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} finally {
if (inChannel != null)
inChannel.close();
if (outChannel != null)
outChannel.close();
}
dst.setExecutable(true);
dst.setReadable(true);
src.delete();
}
ファイルは正しく移動され、src ファイルは正常に削除されました。問題は、ギャラリーで画像またはビデオを開こうとすると、黒く表示されるか、ビデオを再生できないことです。そのため、ファイルマネージャーで確認したところ、ファイルのアクセス許可が間違っていることがわかりました。何か提案はありますか?
ありがとう。