如果网址包含空格,毕加索将无法运作 [英] Picasso not working if url contains space
本文介绍了如果网址包含空格,毕加索将无法运作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个Android应用,其中我要从服务器中检索图像并使用Picasso在图像视图中显示该图像.即使我可以在浏览器中成功测试某些图像URL,也无法使用.
I am developing an Android app in which I am retrieving an image from a server and show it in an image view using Picasso. Some image URLs don't work even though I can test them successfully in a browser.
例如,此URL正常工作:
For example this URL works correctly:
http://www.tonightfootballreport.com/\Filebucket\Picture\image\png\20160730011032_BPL.png
但是这个失败了:
http://www.tonightfootballreport.com/\Filebucket\Picture\image\png\20160807025619_Serie A.png
区别似乎在于失败的URL包含空格.我需要做些什么才能使它起作用?
The difference appears to be that the failing URL contains a space. What do I need to do to make this work?
推荐答案
String temp = "http://www.tonightfootballreport.com/\Filebucket\Picture\image\png\20160807025619_Serie A.png";
temp = temp.replaceAll(" ", "%20");
URL sourceUrl = new URL(temp);
这篇关于如果网址包含空格,毕加索将无法运作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文