java - 如何在android中使用Camera 2 api保存文件
问题描述
像这样使用camera2 api im保存文件
if (Build.VERSION.SDK_INT <=Build.VERSION_CODES.P){
final String folderPath = Environment.getExternalStorageDirectory() + "/Pikpap/";
file1 = new File(folderPath);
} else{
file1 = new File( CameraFragment.view.getContext().getExternalFilesDir()+ "/Pikpap/");
}
if (!file1.exists()) {
file1.mkdirs();
}
String fullName = file1.getAbsolutePath() + "Pikpap" + currentTime+name + ".jpg";
File file = new File(fullName);
但有时文件未保存并且图像视图上的图像空白设置此问题在所有设备上创建
解决方案
推荐阅读
- flutter - flutter_webrtc :如何在 visio 期间向对等方发送短信
- c# - 如何修复“项目 'ListView1' 加载失败:[MSB4236] 找不到指定的 SDK 'Microsoft.NET.Sdk'。”在带有 Xamarin.Forms 的 Rider 上
- php - 用 .htaccess 重写 URL 到 PHP 路由器
- typescript - 如何在页面加载之前加载用户
- html - 为什么整个图像不适合块?
- c++ - 无法在 C++ (cpp) 中使用 ifstream 读取 txt 文件
- python - 如何检查列是否包含列表
- javascript - 等待功能完成后再继续
- reactjs - 如何使元素正确重置其状态并在专注于输入的同时传递道具
- python - FastAPI 端点未接收到发布数据