毕加索图片未加载

时间:2015-10-07 13:55:34

标签: android picasso

这是从主题Picasso Images are not loading in Gridview Android

扩展而来的

现在新问题是毕加索没有正确加载图像。如果我硬编码图像网址,那么图像将会显示(虽然重复)。

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    if(convertView == null) {
        //Inflate the XML based 

Layout
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.movies_item, parent, false);
}

//Get the ImageView
ImageView movieThumbnail = (ImageView) convertView.findViewById(R.id.movies_item_thumbnail);

//Load Image into the ImageView
Picasso.with(context).load(movies.get(position).getThumbnail()).into(movieThumbnail);

//When I hardcode the url, the image shows as shown in the screenshot below       
//Picasso.with(context).load("http://image.tmdb.org/t/p/w500/nBNZadXqJSdt05SHLqgT0HuC5Gm.jpg").into(movieThumbnail);
Log.v("Populating", movies.get(position).getThumbnail());

return convertView;
}

我完全迷失了。它也不会抛出任何错误。 HELP !!!!!!!!

Screenshot

[UPDATE] 请参阅此链接以获得解决方案!

OkHTTP and Picasso don't run together

2 个答案:

答案 0 :(得分:0)

试试这个

movies.get(position).getThumbnail().toString()

并确保您的网址已完整

答案 1 :(得分:0)

我会以这种方式试试我的代码..  。Picasso.with(CTX).load(将String.valueOf(images.get(位置)))错误(R.drawable.scorpion).into(serve_dish_iv);这里变量"图像"是ArrayList变量..试试这种方式

Picasso.with(上下文).load(movies.get(位置).getThumbnail())错误(R.drawable .defulticon).into(movieThumbnail)。

如果没有任何图像可用,则显示默认图像..如果有任何问题,请问我..