Search code examples
androidimagepicassoandroid-glide

Glide and Picasso not load images from YouTube


I'm new with ImageView, Picasso, Glide. I want just to load image from url, i've tried Glide and Picasso. Both of them load images well but if i try to load images from youtube(thumbnail) - not loading. // http://i.ytimg.com/vi/z0NfI2NeDHI/sddefault.jpg - not loading

MainActivity.java

imageView = findViewById(R.id.image);
videoImg = ""
fetchData.execute(); //returns link for image to videoImg
Glide.with(this)
                .load(videoImg)
                .placeholder(R.drawable.ic_launcher_background)
                .error(R.drawable.ic_launcher_foreground)
                .into(imageView);
        Picasso.get().load(videoImg).into(imageView);

activity_main.xml

<ImageView
        android:id="@+id/image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

LogCat

W/Glide: Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored
W/Glide: Load failed for null with size [0x0]
    class com.bumptech.glide.load.engine.GlideException: Received null model

Solution

  • Well, awkward situation.. I use custom AsyncTask which returns String(link to yt image)(in my case videoImg) so my code was:

    void ShowImage(View v){
        fetchData.execute();
        Glide.with(MainActivity.this)
                    .load(videoImg)
                    .placeholder(R.drawable.ic_launcher_background)
                    .error(R.drawable.ic_launcher_foreground)
                    .into(imageView);
    }
    

    So AsyncTask does not have time to download the link and Glide just trying to load empty string..

    Sorry again..