小编Moh*_*lam的帖子

ExifInterface的图片不受支持

我已经ExifInterface在Android应用程序中使用过以获取图像的相机方向。我的代码非常适合Build.VERSION.SDK_INT < 24。但是,当构建版本大于或等于24时,它将在android studio logcat中发出警告,并且无法正常工作。

这是我的onActivityResult方法的代码块:

if(requestCode == REQUEST_CAPTURE_IMG && resultCode == RESULT_OK) {
            Log.d(TAG, "Inside camera operation");
            int reqWidth = 480, reqHeight = 800;
            try {
                InputStream inStream = null;
                try {
                    inStream = getContentResolver().openInputStream(imageUri);

                    //Decode image size
                    BitmapFactory.Options options = new BitmapFactory.Options();
                    options.inJustDecodeBounds = true;

                    BitmapFactory.decodeStream(inStream, null, options);
                    inStream.close();

                    options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);

                    options.inJustDecodeBounds = false;
                    inStream = getContentResolver().openInputStream(imageUri);

                    CommonStaticClass.mImage = BitmapFactory.decodeStream(inStream, null, options);

                    ExifInterface exif = null;

                    try {
                        //File pictureFile = …
Run Code Online (Sandbox Code Playgroud)

android

6
推荐指数
1
解决办法
5151
查看次数

标签 统计

android ×1