相关疑难解决方法(0)

Android三星:相机应用程序不会返回intent.getData()

我正在开发一个应用程序,其中从本机相机应用程序拍摄的图像.将向用户显示.我做的代码是:

/* Intent */
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, TAKE_PICTURE);

/* Result */
onActivityResult(int requestCode, int resultCode,
        Intent returnIntent) {
    if(requestCode == TAKE_PICTURE) {
        //picture from Camera
        if (resultCode == Activity.RESULT_OK) {
            if(returnIntent != null) {
                try {
                    // Get the file path where the image is stored.
                    // This runs fine on all devices, except Samsung ones.
                    Uri selectedImage = returnIntent.getData();

                    if(selectedImage == null) {
                        if(returnIntent.getExtras() != null &&
                            returnIntent.getExtras().get(AppConstants.DATA) != null) {

                            // But, I get the …
Run Code Online (Sandbox Code Playgroud)

android

8
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1