问题描述
我的应用程序会拍照,然后在必要时进行压缩。在新的 s20 手机上出现错误。
BitmapFactory.Options scaleOptions = new BitmapFactory.Options();
scaleOptions.inJustDecodeBounds = true;
BitmapFactory.decodeFile(path,scaleOptions);
Log.d("ImageCompressor","Scale out width " + scaleOptions.outWidth);
Log.d("ImageCompressor","Scale out height " + scaleOptions.outHeight);
在所有较旧的手机和平板电脑上,outWidth 和 Height 日志将具有 pos 值
使用新的 s20 它们是“-1”
当值为 -1 时是什么意思? 目标 apk 仍然是 23
我一直都是用下面的方法来拍照
String extStorageDirectory = getExternalFilesDir(Environment.DIRECTORY_PICTURES).toString();
File mFolder = new File(extStorageDirectory + "/location_pics");
创建文件名后
picFileNamePath = mFolder.getAbsolutePath() + "/full" + filename;
picDir = mFolder;
uriToSend = Uri.fromFile(file);
uriToCompress = Uri.fromFile(fileFull);
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(fileFull));
startActivityForResult(cameraIntent,2);
之后存在但我无法解码的文件名被命名 /storage/emulated/0/Android/data/com.android.hgs.tview/files/Pictures/location_pics/fullDORAND_1_1.jpg
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)