Including a .gif in android project -


my question how can attach little gif fire bottom of spaceship in game.if have ideas,i'd love heat them. thank you!

i highly recommend use new fresco library (made facebook). handles kinds of image loading , it's highly customizable.

  • fastest play gif (faster ion)
  • easy use

include dependency build.gradle:

dependencies {   // app's other dependencies   compile 'com.facebook.fresco:fresco:0.7.0+' } 

here's link how setup fresco: http://frescolib.org/docs/getting-started.html#

to play gif should this:

simpledraweeview draweeview = (simpledraweeview) findviewbyid(r.id.gif_draweeview);  uri uri = uri.parse("res:///" + r.drawable.gif_animation); draweecontroller controller = fresco.newdraweecontrollerbuilder()             .seturi(uri)             .setcontrollerlistener(new controllerlistener<imageinfo>() {                 @override                 public void onsubmit(string s, object o) {                  }                  @override                 public void onfinalimageset(string s, imageinfo imageinfo, final animatable animatable) {                     if(animatable != null) {                         animatable.start();                     }                 }                  @override                 public void onintermediateimageset(string s, imageinfo imageinfo) {                  }                  @override                 public void onintermediateimagefailed(string s, throwable throwable) {                  }                  @override                 public void onfailure(string s, throwable throwable) {                  }                  @override                 public void onrelease(string s) {                 }             })             .build(); draweeview.setcontroller(controller); 

Comments