-2
ImageView img = findViewById(R.id.img);
int resId = R.drawable.coffee;
Picasso.get().load(resId).into(img);

Why it is not working. but the following worked fine:

ImageView img = findViewById(R.id.img);
String path= "https://images.pexels.com/photos/434213/pexels-photo-434213.jpeg";
Picasso.get().load(path).into(img);

2 Answers2

1

Try to use following code (this is context):

Picasso.with(this)
.load(R.drawable.coffee)
.into(img);

You can also ged rid of Picasso:

img.setImageResource(R.drawable.coffee);
samaromku
  • 560
  • 2
  • 7
0

The problem was that I was adding image to drawable directly by copy and paste. But you need to add it properly using minmap. The your drawable resource will work in Picass without any issue.