I am trying to use android.graphics.Movieto play a GIF file from /sdcard/download.
If I put the file in a folder drawablein the APK, I can upload it using:
InputStream istr = context.getResources().openRawResource(R.drawable.animfile);
Movie movie = Movie.decodeStream(istr);
It works. movie.duration()will show the correct duration that I use to get the value for movie.setTime().
The problem occurs if instead of drawable I try to load it from an SD card using
String path = Environment.getExternalStorageDirectory() + "/download/animfile.gif";
Movie movie = Movie.decodeFile(path);
Something seems to be loading because movieit is not null. But the problem is what movie.duration()returns 0.
Any idea why this is happening, and what should I do?
source
share