The following Wheat Academy to introduce to you students about the Android development in the movie import play gif picture file exception Ioexception.reset solution, I hope that some ways to help you.
When you play a GIF picture using movie, you can import GIF files in assets as normal, such as:
The code is as follows
Is=context.getresources (). Openrawresource (R.drawable.mygif);
Movie =movie.decodestream (IS);
However, when the network image is loaded locally, the following error is reported:
The code is as follows
Java.io.IOException
Atjava.io.InputStream.reset (inputstream.java:218)
Atandroid.graphics.Movie.decodeStream (Native Method)
Atandroid.graphics.Movie.decodeTempStream (movie.java:74)
Atandroid.graphics.Movie.decodeFile (movie.java:59)
I have declared permissions in Androidmanifest.xml:
The code is as follows
<uses-permissionandroid:name= "Android.permission.INTERNET"/>
At Www.maiziedu.com>.graphics.decodeStream (Nativemethod)
<uses-permissionandroid:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/>
Workaround:
The code is as follows
InputStream is =null;
try {
is = new Bufferedinputstream (new FileInputStream (New File (Getcachedir (), "Mygif.gif")), 16 * 1024);
Is.mark (16 * 1024);
} catch (FileNotFoundException e) {
TODO auto-generated Catch block
E.printstacktrace ();
}
Movie =movie.decodestream (IS);
Problems with the movie import gif picture exception in Android development