这可能是一个老问题,但我找不到任何解决方案。于是又问了
我正在尝试捕获图像并将其存储在内部存储中,并在我的应用程序中使用后将其删除。它在除三星 Note 3 之外的所有设备上都运行良好。
private void captureImage() {
try {
if(photoPath!=null) {
new File(photoPath).delete();
photoPath = null;
}
//SET THE IMAGE NAME AND IMAGE PATH FOR THE CURRENT IMAGE
final Random random = new Random();
photoPath = getPath(this)+"/img" + String.valueOf(random.nextInt()) + ".jpg";
final Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
final File imageStorage = new File(photoPath);
if (imageStorage != null) {
//to capture full image use URI otherwise use filepath
Uri photoURI = FileProvider.getUriForFile(this, "<<my path>>.fileprovider", imageStorage);
intent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
startActivityForResult(intent, Constants.ACTION_CAMERA_REQUEST);
}
}
catch (Throwable e) {
}
}
有什么我在这里想念的吗。请任何人都可以帮助我