[英]How to get my saved photos in this file manager in Android Studio
I have some issues with my application, I have code that opening camera and saving taked photos but, i can't locate them when i'm using file manager.我的应用程序有一些问题,我有打开相机并保存拍摄照片的代码,但是当我使用文件管理器时我找不到它们。 Can someone help me?有人能帮我吗?
This is, my code to take photos:这是我的拍照代码:
cameraBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mPhotoUri = FileProvider.getUriForFile(MainActivity.this, BuildConfig.APPLICATION_ID + ".provider", createImageFile());
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.setClipData(ClipData.newRawUri("A photo", mPhotoUri));
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
intent.putExtra(MediaStore.EXTRA_OUTPUT, mPhotoUri);
startActivityForResult(intent, ACTIVITY_REQUEST_CODE);
}
});
private File createImageFile() {
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = new File(getFilesDir(), "images/");
if (!storageDir.exists()) storageDir.mkdirs();
File image = null;
try {
image = File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
} catch (IOException e) {
e.printStackTrace();
}
// Save a file: path for use with ACTION_VIEW intents
mCurrentPhotoPath = "file:" + image.getAbsolutePath();
return image;
}
This staff saves photos in: /data/data/com.example.miarkait/files/images
该工作人员将照片保存在: /data/data/com.example.miarkait/files/images
And this is code that opening file manager:这是打开文件管理器的代码:
imageBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(Intent.ACTION_GET_CONTENT, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
final int ACTIVITY_SELECT_IMAGE = 1234;
startActivityForResult(i, ACTIVITY_SELECT_IMAGE);
}
});
But in this manager, i can see only photos taken by "original" camera: RESULT但是在这个经理中,我只能看到“原始”相机拍摄的照片: RESULT
File(getFilesDir()....文件(getFilesDir()....
getFilesDir() is your app private storage location. getFilesDir() 是您的应用程序私有存储位置。
No other app has access.没有其他应用程序可以访问。
Not even file managers.甚至没有文件管理器。
And you cannot pick it with ACTION_GET_CONTENT.而且你不能用 ACTION_GET_CONTENT 来选择它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.