-2

I'm trying to show .gif image in my app. But it is not working and nothing is showing there. I've added glide library in dependency too. What should i do now?

Here goes VegetableActivity.java file

public class VegetableActivity extends Activity{
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_vegetable);
        ImageView load_Image = (ImageView)findViewById(R.id.load_Image);

        Glide.with(this)
                .load("https://media.giphy.com/media/m80Q4HTDNPFHq/giphy.gif")

                .into(load_Image);


    }
}

Here goes layout xml file activity_vegetable.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"

    android:id="@+id/activity_vegetable"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.emma.kidbox.VegetableActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="THIS IS AN EXAMPLE OF GLIDE LIBRARY IN ANDROID"
        android:fontFamily="sans-serif-condensed"
        android:id="@+id/textView"
        android:textSize="30dp"/>

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/load_Image"
        android:layout_below="@+id/textView"
        android:layout_centerHorizontal="true"/>

</LinearLayout>
Israt
  • 87
  • 1
  • 9
  • try this https://stackoverflow.com/a/31128019/8089770 – Vidhi Dave Oct 11 '17 at 04:11
  • 2
    Possible duplicate of [Show GIF file with Glide (image loading and caching library)](https://stackoverflow.com/questions/31082330/show-gif-file-with-glide-image-loading-and-caching-library) – Vidhi Dave Oct 11 '17 at 04:11
  • 1
    Possible duplicate of [Adding gif image in an ImageView in android](https://stackoverflow.com/questions/6533942/adding-gif-image-in-an-imageview-in-android) – sushildlh Oct 11 '17 at 04:12

1 Answers1

0

try this use .asGif() method of Glide to load gif in Imageview

Glide.with(this)
     .load("https://media.giphy.com/media/m80Q4HTDNPFHq/giphy.gif")
     .asGif()
     .into(load_Image);
AskNilesh
  • 67,701
  • 16
  • 123
  • 163