老师的这种方法在4.4上测试是有效的,但是我在android7.0上就会报错
android.os.FileUriExposedException: file:///storage/emulated/0/IMGSun%20Mar%2019%2022%3A24%3A27%20GMT%2B08%3A00%202017.png exposed beyond app through ClipData.Item.getUri()
android.os.FileUriExposedException: file:///storage/emulated/0/IMGSun%20Mar%2019%2022%3A24%3A27%20GMT%2B08%3A00%202017.png exposed beyond app through ClipData.Item.getUri()
2017-03-19
最赞回答 / MyBilly
Environment.getExternalStorageDirectory().getPath()改成Environment.getRootDirectory().getPath()intent.putExtra第二参数是uri,不是传递file!无语,你得有多粗心啊。。。
2017-03-19
最新回答 / qq_乾坤_3
http://www.imooc.com/search/course?words=android%E5%9B%BE%E5%83%8F%E5%A4%84%E7%90%86
2017-03-12
Camera.Size pictureSize = supportedPictureSizes.get(0);从这个list中取0是不严谨的,需要自己获取屏幕的宽度,然后遍历这个list,如果没有你的屏幕宽度,就取中间值,拿到下标index这样在supportedPictureSizes.get(index);这样是比较严谨的做法
2017-02-28
得到的图片是压缩的,是因为自定义相机拍出来的图片很少,需要在设置几个参数如下
List<Camera.Size> supportedPictureSizes = parameters.getSupportedPictureSizes();
Camera.Size pictureSize = supportedPictureSizes.get(0);
parameters.setPreviewSize(pictureSize .width, pictureSize .height);
mCamera.setParameters(parameters);
这是设置照片的大小,预览大小也可以如此
List<Camera.Size> supportedPictureSizes = parameters.getSupportedPictureSizes();
Camera.Size pictureSize = supportedPictureSizes.get(0);
parameters.setPreviewSize(pictureSize .width, pictureSize .height);
mCamera.setParameters(parameters);
这是设置照片的大小,预览大小也可以如此
2017-02-28