GIFView
GIFView copied to clipboard
Only first image is displayed
Hello, I successfully used this view in my app but when I am setting GIF by using InputStream only first image is displayed.
Please any suggestion...
My code is....
final GIFView mGifView = (GIFView) findViewById(R.id.main_activity_gif_vie);
InputStream is=null;
try {
is=new FileInputStream("/sdcard/test.gif");
mGifView.setGifResource(is);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
mGifView.setOnSettingGifListener(new GIFView.OnSettingGifListener() {
@Override
public void onSuccess(GIFView view, Exception e) {
Toast.makeText(Main2Activity.this, "onSuccess()", Toast.LENGTH_SHORT).show();
mGifView.start(); // I have tested with and without this statement
}
@Override
public void onFailure(GIFView view, Exception e) {
}
});
I tested it with few InputStreams and it worked.
Did you try with different file? Maybe the problem is with the file? Note that every time you set a GIF resource (even from a string in your asset directory) the library is using its InputStream. You can also try to check the exception passed in GIFView.OnSettingGifListener#onFailure, maybe it caught something.
If you see the first image it means that at least it has the first frame so what is the result when you invoke getGifDuration()?