0
私はちょうどアンドロイドアプリを開発し始めたので、私はあなたの助けが必要です。getExternalFilesDirがファイルを内部ストレージに保存するのはなぜですか
ここに私のコードです。
private File createImageFile() throws IOException{
File image = null;
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); //Get Date
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES); //Get the directory of pictures
if (isExertnalStorageWritable()){
if(isExternalStorageReadable()) {
image = File.createTempFile(imageFileName, ".jpg", storageDir); //Create the temp file
mCurrentPhotoPath = image.getAbsolutePath();
}
}
return image;
}
私の一時ファイルは、常に外部ストレージではなく内部ストレージに作成されています。
Try Environment.getExternalStorageDirectory()は、アプリケーション固有のフォルダではなく、デバイスのベースフォルダを取得します。 – pantos27