安卓11有权限要求,以下方法管用
//跳转到相机 private voID showCamera() { file fileDir = new file(Environment.getExternalStorageDirectory(),"Pictures"); if (!fileDir.exists()){ fileDir.getParentfile().mkdir(); } filePath = fileDir.getabsolutePath() + "/img_" + System.currentTimeMillis() + ".jpg"; Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (Build.VERSION.SDK_INT > 24){ imageUri = fileProvIDer.getUriForfile(this,this.getPackagename() + ".fileprovIDer", new file(filePath)); } else { imageUri = Uri.fromfile(new file(filePath)); } intent.putExtra(MediaStore.EXTRA_OUTPUT,imageUri); startActivityForResult(intent,TAKE_PHOTO); }
总结 以上是内存溢出为你收集整理的Android 11 拍照问题全部内容,希望文章能够帮你解决Android 11 拍照问题所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)