android从URL加载图像的问题
我正在 android 中制作一个应用程序,它从 URL 加载图标大小的图像
我尝试使用以下代码下载图像。
已从给定 URL 下载了一张标记为 default.png 的图像,但未下载另一张标记为 v_1234.jpg 的图像。我不知道出了什么问题。它只是返回 jpg 图像的 null 值。
我不确定这是 .jpg 格式的问题,我的代码没有下载 jpg 格式的图像,还是标签名称问题,由于标签中的下划线 (_) 使其无法下载。
请帮助您专业的朋友在那个领域。
代码:
URL url = new URL(detail.voucher_image.toString());
Bitmap bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
imageView.getImageBitmap(bmp);
非常感谢。
I am making an application in android which loads Icon size images from URL
i have tried downloading images using the following code.
One image labeled default.png was downloaded from the given url but there was another image labeled v_1234.jpg is not being downloaded. I dont know whats the problem. it just returns me null for jpg image.
I am not sure that its a problem for .jpg format that my code is not downloading the jpg format images or Its the labeled name problem that due to Underscore (_) in the label makes it not downloadable..
Please help Friends you are professional in that field.
CODE:
URL url = new URL(detail.voucher_image.toString());
Bitmap bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
imageView.getImageBitmap(bmp);
Thanks alot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个代码
try this code
使用以下代码从 url 获取位图
use the following code to get bitmap from url