2016-04-11 169 views
0

我想加载一些图像到列表视图使用毕加索,但我只看到我的占位符图像。我正在从RSS源中加载数据,并可以确认一切正常,与我的旧供稿网址正常工作。两者之间的唯一区别是图像URL的格式不同。我得到的网址,但我的占位符图像永远不会被URL中的图像取代。图像不从URL加载

在我的片段:

NodeList nodes = doc.getElementsByTagName("enclosure"); 
      for (int i = 0; i < nodes.getLength(); i++) { 
       Element thumbElement = (Element)nodes.item(i); 
       String thumbURL = thumbElement.getAttribute("url"); 
       if (thumbURL.equals("")) { 
        thumb[i] = "null"; 
       } else { 
        thumb[i] = thumbURL; 
       } 
      } 

在我的适配器:

if (ActionAlertsFragment.thumb[position] != "null") { 
      System.out.println(ActionAlertsFragment.thumb[position]); 
      Picasso.with(context) 
        .load(ActionAlertsFragment.thumb[position]) 
        .placeholder(R.drawable.placeholder) 
        .error(R.drawable.placeholder) 
        .into(holder.thumbnail); 
     } else { 
      holder.thumbnail.setImageResource(R.drawable.placeholder); 
     } 

一位来自新Feed中的图片网址:从旧料 http://www.kyfb.com/index.cfm/_api/render/file/?fileID=38C277EC-9B70-510A-DE9D93916BAF084C&fileEXT=.jpg

图片网址: http://kyfbnewsroom.com/wp-content/uploads/2013/01/250px-KY_State_Capitol.jpg

,工程旧饲料: http://kyfbnewsroom.com/category/public-affairs/notifications/feed/

不加载图片的新饲料: https://www.kyfb.com/index.cfm/_api/feed/v1/KYFB/?feedID=61433D1B-DAB1-6572-3CD3CBF8A0142B4B

我开始觉得图像没有得到来自新网址加载,因为图像的URL格式不同,出于某种原因无法正确加载。来自旧供稿的图片网址按预期工作。

+0

您是否在manifest.xml中添加了网络权限? – USKMobility

+0

是的。我从RSS提要中获得所有其他数据就好了,如果我使用此提要的旧版本与不同的网址,则一切正常。 – raginggoat

回答

0

好像你有问题就在这里

if (ActionAlertsFragment.thumb[position] != "null") { 

只是用“等于”功能,我认为这会工作

if (!ActionAlertsFragment.thumb[position].equals("null")) { 
+0

这仍然不起作用。 – raginggoat

1

我结束了更换“HTTP”,在解决这个每个URL都带有“https”

+0

这也是我的解决方案。 – user3718908