老師的這種方法在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.xianlaiwan.cn/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