android - Play Gif Once using Fresco Library -


i using following code play gif, here keeps on repeating gif play.

uri uri; draweecontroller controller = fresco.newdraweecontrollerbuilder()     .seturi(uri)     .setautoplayanimations(true)     . // other setters     .build(); msimpledraweeview.setcontroller(controller); 

how can play once?

well, have not used fresco gif file might 1 out. use below library gif file loading.
refer link
code, , works well:

public class mainactivity extends appcompatactivity {  private gifimageview mgigimageview;  @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main);       mgigimageview = (gifimageview) findviewbyid(r.id.mgif);       gifdrawable gifdrawable = null;      try {           gifdrawable = new gifdrawable(getresources(), r.drawable.ani_1);           gifdrawable.setloopcount(1);          } catch (ioexception e) {           e.printstacktrace();           }      mgigimageview.setimagedrawable(gifdrawable);     } } 

Comments