Search code examples
androidandroid-imageviewandroid-drawableapk-expansion-files

Display drawable[] with swipe


I want to display some drawables recovered from an expansion file into an imageView/Gallery or something else that can use swipe gestures, so I've tried to use :

imageView.setImageDrawable(myDrawable[]);

But it returns me that the method setImageDrawable(Drawable) in the type ImageView is not applicable for the arguments (Drawable[]).

What's the proper way to display Drawables[] in my case ?


Solution

  • myDrawable[] is your Drawable array. Not a single drawable.

    and the method imageView.setImageDrawable(); is used for single drawable as an argument.

    So use it like,

    imageView.setImageDrawable(myDrawable[index]); // index is a key from your drawable array for particular drawable position