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

 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就可以了 
        }     
    }

你可能感兴趣的:(android状态栏)