如何在sd卡中选择下载文件的文件夹

发布于 2024-12-24 19:55:01 字数 83 浏览 3 评论 0原文

在我的应用程序中,我需要从服务器下载文件到SD卡。但是在下载之前,我需要在SD卡中选择要下载文件的文件夹(任何文件夹)。那么如何选择SD卡中的文件夹呢?

In my app, I need to download a file from the server to sdcard.But here before download I need to select the folder(any folder) in sdcard where the file should download.So how to select the folder in sdcard?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

帅的被狗咬 2024-12-31 19:55:01

这就是我将照片保存在 SD 卡中的方法。

OutputStream stream = null;
File tmpFile = creatTempFile();

try {
    stream = new FileOutputStream(tmpFile);
} catch (FileNotFoundException e) {
    e.printStackTrace();  
}
yourImage.compress(Bitmap.CompressFormat.JPEG, 80, stream);


private File creatTempFile(){
    final File path = new File( Environment.getExternalStorageDirectory(), "folder_name" );
    if(!path.exists()){
        path.mkdirs();
    }
    return new File(path, "file_name");
}

抱歉,昨天我想将我的代码复制到这里,但是复制了担心代码,这是对的。

this is how i save my pic in SD card.

OutputStream stream = null;
File tmpFile = creatTempFile();

try {
    stream = new FileOutputStream(tmpFile);
} catch (FileNotFoundException e) {
    e.printStackTrace();  
}
yourImage.compress(Bitmap.CompressFormat.JPEG, 80, stream);


private File creatTempFile(){
    final File path = new File( Environment.getExternalStorageDirectory(), "folder_name" );
    if(!path.exists()){
        path.mkdirs();
    }
    return new File(path, "file_name");
}

sorry,yesterday I want to copy my codes to here,but copy the worry codes,this is right.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文