毕加索无法加载图片

时间:2017-05-20 17:18:33

标签: android android-recyclerview imageview picasso

我正在尝试从毕加索的网络加载图像,但没有显示任何内容。 搜索了整个 SO ,没有。也给出了互联网许可。 但是这是回收器适配器代码

    package com.example.alpit.retro;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import java.util.List;

/**
 * Created by Alpit on 15-05-2017.
 */

public class MovieAdapterJava extends RecyclerView.Adapter<MovieAdapterJava.MovieViewHolder> {
    private List<Movie> movies;

    public Context context;
    public ImageView im;


    public MovieAdapterJava(List<Movie> movies, Context c) {
        this.movies = movies;
        context = c;

    }


    @Override
    public MovieViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.card, parent, false);
        MovieViewHolder vh = new MovieViewHolder(v);
        return vh;
    }


    @Override
    public void onBindViewHolder(MovieViewHolder holder, int position) {

        holder.movieTitle.setText(movies.get(position).getTitle());
        holder.date.setText(movies.get(position).getRelease_date());
        holder.movieDes.setText(movies.get(position).getOverview());
        holder.rate.setText(movies.get(position).getVoteAverage().toString());
        Picasso.with(context).load(movies.get(position).getPoster_path()).into(holder.imageView);
        Picasso.with(context).setLoggingEnabled(true);

    }

    @Override
    public int getItemCount() {
        return movies.size();
    }

    public class MovieViewHolder extends RecyclerView.ViewHolder {
        public TextView movieTitle;
        public TextView movieDes;
        public TextView date;
        public TextView rate;
        public ImageView imageView;


        public MovieViewHolder(View itemView) {
            super(itemView);
            movieTitle = (TextView) itemView.findViewById(R.id.title);
            movieDes = (TextView) itemView.findViewById(R.id.description);
            date = (TextView) itemView.findViewById(R.id.date);
            rate = (TextView) itemView.findViewById(R.id.rating);
            imageView = (ImageView) itemView.findViewById(R.id.image);

        }
    }
}

这是我得到的错误日志。

 D/Picasso: Main        created      [R32] Request{/yRXTVpDRBA3983C3HjoY0SO4dV6.jpg}
D/Picasso: Dispatcher  enqueued     [R32]+2ms 
D/Picasso: Hunter      executing    [R32]+3ms 
D/Picasso: Dispatcher  batched      [R32]+3ms for error
D/Picasso: Main        errored      [R32]+207ms 
D/Picasso: Dispatcher  delivered    [R32]+207ms 
D/Picasso: Main        created      [R33] Request{/yPisjyLweCl1tbgwgtzBCNCBle.jpg}
D/Picasso: Dispatcher  enqueued     [R33]+1ms 
D/Picasso: Hunter      executing    [R33]+1ms 
D/Picasso: Dispatcher  batched      [R33]+3ms for error
D/Picasso: Main        errored      [R33]+204ms 
D/Picasso: Dispatcher  delivered    [R33]+205ms 

这个错误正在重复。我得到的网址是我可以看到的,但是无法获取图片。

0 个答案:

没有答案