1

I am using the AppIntro https://github.com/apl-devs/AppIntro library with the default slides builder.

It works great but I am having trouble passing gifs as the drawable for the default builder.

addSlide(AppIntroFragment.newInstance(title, description, image, backgroundColor));

I read that android has issues displaying gif by default and I have to use GifImageLoader or Glide to load the gif.

Glide
 .with(context)
 .load("imageUrl")
 .asGif()
 .placeholder(R.drawable.gifImage) 
 .crossFade()
 .into(imageView)

I could try this but I don't have an imageView where I can pass into the argument if I use the default builder.

I also tried GifDrawable gifFromResource = new GifDrawable( getResources(), R.drawable.anim ); from Display Animated GIF but it gives an error.

My next closest option is to create a custom fragment to use with AppIntro and I really don't want to do that.

Is there any way to pass the gif into the default slide builder and have it play?

  • you can make your intro slider and modify it as your requirement follow this link https://www.androidhive.info/2016/05/android-build-intro-slider-app/ – AskNilesh Jul 22 '17 at 09:02

1 Answers1

0

You can use Simple Target from Glide library. Override onResourceReady() and load this as image in new slide. Please note I have not tried this with gif and have not access to my dev machine now.

Simple Target docs

user221256
  • 415
  • 5
  • 14
  • `Glide.with( context ).load( eatFoodyImages[0] ).asBitmap().into( target );` I tried replacing asBitmap as per the wiki with asGif but that does not seems to work. Regardless, I have tried using Nilesh's suggestion and that seems to work for me. Not sure if I should post that as an answer or not. – Cheer Chunhao Jul 22 '17 at 09:23