안녕하세요
제가 갤러리에서 사진을 여러장 가지고 와서 Bitmapfactory 로 리사이징 한 후 이미지뷰에 넣을려고 하는데
오류가 납니다 ㅠㅠ 어떤 오류인지 알려주시면 감사하겠습니다 ㅠ
Intent imgadd = new Intent(Intent.ACTION_PICK, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);//사진을 여러개 선택할수 있도록 한다
imgadd.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
imgadd.setType("image/*");
startActivityForResult(Intent.createChooser(imgadd, "Select Picture"), IMAGE_CODE);
여러장 받아올 수 있게 해주는 부분
try {
afd = getContentResolver().openAssetFileDescriptor(clipData.getItemAt(i).getUri(), "rw");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inPreferredConfig = Bitmap.Config.ARGB_8888;
opt.inSampleSize = 4;
opt.inDither = true;
opt.inPurgeable = true;
opt.inInputShareable = true;
opt.inTempStorage = new byte[32 * 1024];
bmp = BitmapFactory.decodeFileDescriptor(afd.getFileDescriptor(), null, opt);
img.setImageBitmap(bmp);
img = newImageCreate();
ll.addView(img);
받아와서 리사이징 하는 부분
그리고 로그캣 입니다.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: kr.ac.yjc.myapplication, PID: 25663
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=100, result=-1, data=Intent { dat=content://com.google.android.apps.photos.contentprovider/-1/1/content://media/external/images/media/355304/ORIGINAL/NONE/1527031423 flg=0x1 clip={text/uri-list U:content://com.google.android.apps.photos.contentprovider/-1/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F355304/ORIGINAL/NONE/1527031423} }} to activity {kr.ac.yjc.myapplication/kr.ac.yjc.myapplication.Board_Write}: java.lang.SecurityException: Permission Denial: writing com.google.android.apps.photos.contentprovider.impl.MediaContentProvider uri content://com.google.android.apps.photos.contentprovider/-1/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F355304/ORIGINAL/NONE/1527031423 from pid=25663, uid=10205 requires the provider be exported, or grantUriPermission()
at android.app.ActivityThread.deliverResults(ActivityThread.java:3758)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3801)
at android.app.ActivityThread.access$1400(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5551)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
Caused by: java.lang.SecurityException: Permission Denial: writing com.google.android.apps.photos.contentprovider.impl.MediaContentProvider uri content://com.google.android.apps.photos.contentprovider/-1/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F355304/ORIGINAL/NONE/1527031423 from pid=25663, uid=10205 requires the provider be exported, or grantUriPermission()
at android.os.Parcel.readException(Parcel.java:1620)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146)
at android.content.ContentProviderProxy.openAssetFile(ContentProviderNative.java:621)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:982)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:887)
at kr.ac.yjc.myapplication.Board_Write.onActivityResult(Board_Write.java:132)
at android.app.Activity.dispatchActivityResult(Activity.java:6463)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3754)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3801)
at android.app.ActivityThread.access$1400(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5551)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)