2013-05-25 11 views
7

私は、ダウンロードマネージャを使用していると私はAndroidのダウンロードマネージャsetDestinationInExternalFilesDir

setDestinationInExternalFilesDir(this, Environment.DIRECTORY_DOWNLOADS, "example.ext"); 

を使用するときにファイルがダウンロードフォルダ/アンドロイド/データ/ com.example.app /ファイルにダウンロードされます。

私は

setDestinationInExternalPublicDir("/folder", "example.ext"); 

をしようとすると、私が得る: IllegalStateException: Cannot create directory mnt/sdcard/folder。 WRITE_EXTERNAL_STORAGE権限も設定しました。

私は間違っていますか?

答えて

0

は、なぜあなたは、私は、これはでもあなたのために働くかもしれないと思いExternalFileDir

File sdCard = Environment.getExternalStorageDirectory(); 
String folder = sdCard.getAbsolutePath() + "/YourFolder" ; 
File dir = new File(folder); 
if (!dir.exists()) { 
if (dir.mkdirs()) { 
    Log.i(Tag,"Directory Created"); 
    } 
} 

ためabsoluteパスを使用しないでください。

+0

は、私は次のことを試してみました。 downloadRequest.setDestinationInExternalFilesDir(v.getContext()、folder、down.getTitle()+ "。epub")); ファイルは ファイルにダウンロードされます:///mnt/sdcard/Android/data/com.example.app/files/*folder-path* –

+0

Android/Androidからダウンロードしたファイルを移動して一時的に修正しました。 data/com.example.app/filesを必要なディレクトリにコピーします。 –

0

使用request.setDestinationInExternalPublicDir("/folder", "FileName.extention");これは私のために働いた

..

関連する問題