我正在使用RSS提要处理新闻android项目,我的应用程序现在可以完美地获取标题,描述,新闻时间,但它来到图像它显示以下错误:
Cannot resolve symbol 'PicassoClient'
这是我的代码:
public class MyAdapter extends RecyclerView.Adapter<MyViewHolder> {
Context c;
ArrayList<Article> articles;
public MyAdapter(Context c, ArrayList<Article> articles) {
this.c = c;
this.articles = articles;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v= LayoutInflater.from(c).inflate(R.layout.model,parent,false);
return new MyViewHolder(v);
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
Article article=articles.get(position);
String title=article.getTitle();
String desc=article.getDescription();
String date=article.getDate();
String imageUrl=article.getImageUrl().replace("localhost","10.0.2.2");
holder.titleTxt.setText(title);
holder.desctxt.setText(desc.substring(0,130));
holder.dateTxt.setText(date);
PicassoClient.downloadImage(c,imageUrl,holder.img);
}
@Override
public int getItemCount() {
return articles.size();
}
}
这是我的依赖:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
// compile project(':picasso-2.5.2')
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
}
答案 0 :(得分:0)
将毕加索更新为最新版本
Picasso.get()
.load(imageUrl)
.into(holder.img)
并使用此
{{1}}