Search code examples
javaandroidpicasso

Cannot find get() method while using Picasso in Android


Need help with using Picasso lib in android studio. I want to use it to load image in ImageView. So i added implementation in build.gradle and this was compled to my app. But there is no "get()" or old "with()" methods.

cant see get() in the list

cant see get() in the list

I found it by this way:

Picasso picasso = Picasso.get() is better, but not working

Picasso picasso = Picasso.get() is better, but not working

Still not working for me.

I just want the image will be loaded from phone storage. I can get the path, but dont know how to load into imageview.

EDIT: thanks for answer, but i should repeat it again, but now with your code

code from 1st answer

As you can see, it still not working.

Yes, it's implementation 'com.squareup.picasso:picasso:2.71828'. I reinstalled Android Studio and it didn't work.

EDIT 2: just attached this picture to ensure you, im using the last version.

version of Picasso


Solution

  • You are probably using Picasso at class level. You should use it inside a method in OnCreate() in you are using Activity or inside OnCreateView() for Fragment.

    public class MainActivity  extends Activity {
       ...
    
        @Override
        protected void onCreate(@Nullable Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            ...
    
            Picasso.get()
                    .load("image-resource")
                    .into(imageView);
        }
    }