Android camera intent

前端 未结 6 801
旧巷少年郎
旧巷少年郎 2020-11-22 11:47

I need to push an intent to default camera application to make it take a photo, save it and return an URI. Is there any way to do this?

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 12:40

    Try the following I found Here's a link

    If your app targets M and above and declares as using the CAMERA permission which is not granted, then attempting to use this action will result in a SecurityException.

    EasyImage.openCamera(Activity activity, int type);

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
    
        EasyImage.handleActivityResult(requestCode, resultCode, data, this, new DefaultCallback() {
            @Override
            public void onImagePickerError(Exception e, EasyImage.ImageSource source, int type) {
                //Some error handling
            }
    
            @Override
            public void onImagesPicked(List imagesFiles, EasyImage.ImageSource source, int type) {
                //Handle the images
                onPhotosReturned(imagesFiles);
            }
        });
    }
    

提交回复
热议问题