fishwjy / MultiType-FilePicker

This is a light Android file picker library.
Apache License 2.0
1.4k stars 248 forks source link

点击拍照时如果取消了拍照,会出现一张空白的图片 #11

Closed xiaoyan551 closed 6 years ago

xiaoyan551 commented 7 years ago

点击拍照时如果取消了拍照,会出现一张空白的图片 需要在ImagePickActivity的onActivityResult中判断resultCode != RESULT_OK时删除掉这张图片

`case Constant.REQUEST_CODE_TAKE_IMAGE: if (resultCode == RESULT_OK) {

                Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
                File file = new File(mAdapter.mImagePath);
                Uri contentUri = Uri.fromFile(file);
                mediaScanIntent.setData(contentUri);
                sendBroadcast(mediaScanIntent);

                loadData();
            }else {
                //删除添加的file ,mAdapter.mUri 是将Adapter中创建的图片Uri提到全局并public
                getApplicationContext().getContentResolver().delete(mAdapter.mUri, null, null);
            }`
fishwjy commented 6 years ago

已修改,谢谢