简体   繁体   English

android如何读取外部目录?

[英]How to read external directory android?

I am saving an image like this 我正在保存这样的图像

  File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM); File file = new File(path2, "new-photo-name.jpg"); outputFileUri = Uri.fromFile(file); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); cameraIntents.add(intent); 

Basically, the image is saved in the pictures folder. 基本上,图像保存在图片文件夹中。 My question is how can I read this image later new-photo-name.jpg 我的问题是我以后如何读取此图像new-photo-name.jpg

you can get the file path by: 您可以通过以下方式获取文件路径:

String imgPath = file.getAbsolutePath();

then next time make you can access the file by this path or make new file by this path 然后下次使您可以通过此路径访问文件或通过此路径创建新文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM