// 根据Uri.fromFile(file)方法即可将path转为uri
Uri sourceUri = Uri.fromFile(new File(mSelectPath.get(0)));
// 创建裁剪照片之后保存的路径,也是先用path--->file--->Uri
String saveDir = Environment.getExternalStorageDirectory()
+ "/crop";
File dir = new File(saveDir);
if (!dir.exists()) {
dir.mkdir();
}
Uri destinationUri = Uri.fromFile(new File(saveDir, "crop.jpg"));
UCrop.of(sourceUri, destinationUri)
// .withAspectRatio(16, 9)
.withMaxResultSize(900, 900)
.start(MainActivity.this);
图片Path转换为Uri的方法
最新推荐文章于 2024-04-25 17:48:44 发布