Android 7.0调用系统相机返回路径问题

来源:互联网 发布:剑灵人男捏脸数据截图 编辑:程序博客网 时间:2024/06/07 09:34
 public void startCheckPic() {        int api = SystemUtils.getSystemInfo();         if (api > 23) {            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE, null);            filePath += File.separator + String.valueOf(System.currentTimeMillis()) + "camera" + ".png";            ContentValues contentValues = new ContentValues(1);            contentValues.put(MediaStore.Images.Media.DATA, filePath);            Uri uri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);            intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);            startActivityForResult(intent, 101);        } else {            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE, null);            filePath += File.separator + String.valueOf(System.currentTimeMillis()) + "camera" + ".png";            intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(filePath)));            startActivityForResult(intent, 101);        }    }    } //选择照片返回结果    @Override    protected void onActivityResult(int requestCode, int resultCode, Intent data) {        super.onActivityResult(requestCode, resultCode, data);        if(){        //这里直接拿上面filepath就可以了         }         }
阅读全文
0 1
原创粉丝点击