【发布时间】:2020-05-26 03:26:20
【问题描述】:
我使用 imageview 从图库中捕获和加载图像 但是现在我需要使用图像的路径将图像发送到服务器。谁能帮助我从 imageview 获取该图像的文件路径。
【问题讨论】:
我使用 imageview 从图库中捕获和加载图像 但是现在我需要使用图像的路径将图像发送到服务器。谁能帮助我从 imageview 获取该图像的文件路径。
【问题讨论】:
//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);
【讨论】: