有没有办法从android中的图像视图获取图像路径?

时间:2020-05-26 03:26:20

标签: android path imageview

我已使用imageview从图库中捕获和加载图像 但是现在我需要使用图像的路径将该图像发送到服务器。任何人都可以帮助我从imageview获取该图像的文件路径。

1 个答案:

答案 0 :(得分:0)

//First set imageview
imageview.buildDrawingCache();

//getBitmap from ImageView
Bitmap bm=imageview.getDrawingCache();

FileOutputStream out = new FileOutputStream(filePath);
bitmap.compress(Bitmap.CompressFormat.PNG, 90, out);

MediaStore.Images.Media.insertImage(getContentResolver(), bitmap, imagePath, name, description);
相关问题