android - 有没有办法从android中的图像视图中获取图像路径?
问题描述
我已经使用 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);
推荐阅读
- ruby-on-rails - Rails to_json(methods: => [...]) 用于不同的 ActiveRecords
- java - Android上的相机应用程序
- typescript - 无法读取未定义的属性映射
- php - 如何在 PHP 中使用 date_diff 显示天数月或年
- javascript - 如何在同一元素上多次使用相同的功能
- c# - 如何从多行字符串中提取动态长度字符串?
- java - Spring boot Maven MultiModule Rest api 调用
- java - 如何从 Firestore Android 中的集合中获取文档列表
- r - 将字符串强制转换为向量
- python-3.x - 如何减少内存使用?