gpt4 book ai didi

android - 相机不适用于 android 7.0

转载 作者:行者123 更新时间:2023-11-29 15:39:49 25 4
gpt4 key购买 nike

我得到:android.os.FileUriExposedException。

When targeting Android N, file:// URIs are not allowed anymore. I know We should use content:// URIs instead. However, my app needs file for both image and video. Any ideas?

  mMediaUri = Uri.fromFile(new File(AppHelper.getDirectoryPath(),AppHelper.getFileName() + ".jpeg"));

Intent iCamera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
iCamera.putExtra(MediaStore.EXTRA_OUTPUT, mMediaUri);
startActivityForResult(iCamera, Constants.INTENT_CALL.CAPTURE_IMAGE);

和onActivityResult

case Constants.INTENT_CALL.CAPTURE_IMAGE:
String filePath=SiliCompressor.with(getActivity()).compress(mMediaUri.toString(), true);

Please add sample code...if Available.

最佳答案

经过一些研究终于得到了我的问题的相关答案,只需将最小目标 sdk 版本设置为 23。

关于android - 相机不适用于 android 7.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42562031/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com