When i open app ,i've downlaod some gif image and stored on sd card.
i've checked some url
http://androidosbeginning.blogspot.in/2010/09/gif-animation-in-android.html http://weavora.com/blog/2012/02/07/android-how-to-use-animated-gif/
but in this url example , the gif images loading from drawable folder.
How to load gif image from sd card?
When i use inputstream like
File file=new File("sdcardpat");
InputStream is=new FileInputStream(file);
Movie.decodeStream(is);
i got below error
08-14 13:20:41.621: W/System.err(6052): java.io.IOException
08-14 13:20:41.621: W/System.err(6052): at java.io.InputStream.reset(InputStream.java:218)
08-14 13:20:41.621: W/System.err(6052): at android.graphics.Movie.decodeStream(Native Method)
08-14 13:20:41.621: W/System.err(6052): at com.android.gif.GIFDemo$GIFView.<init>(GIFDemo.java:84)
08-14 13:20:41.621: W/System.err(6052): at com.android.gif.GIFDemo$1.run(GIFDemo.java:36)
08-14 13:20:41.621: W/System.err(6052): at android.os.Handler.handleCallback(Handler.java:615)
08-14 13:20:41.621: W/System.err(6052): at android.os.Handler.dispatchMessage(Handler.java:92)
08-14 13:20:41.621: W/System.err(6052): at android.os.Looper.loop(Looper.java:137)
08-14 13:20:41.621: W/System.err(6052): at android.app.ActivityThread.main(ActivityThread.java:4745)
08-14 13:20:41.621: W/System.err(6052): at java.lang.reflect.Method.invokeNative(Native Method)
08-14 13:20:41.621: W/System.err(6052): at java.lang.reflect.Method.invoke(Method.java:511)
08-14 13:20:41.621: W/System.err(6052): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
08-14 13:20:41.621: W/System.err(6052): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-14 13:20:41.621: W/System.err(6052): at dalvik.system.NativeStart.main(Native Method)
I saw first link you making movie from an InputStream and drawing movie on canvas. InputStream may be anything. If you want to use Image from sdcards then use FileInputStream like below code
File file=new File("sdcardpat");
InputStream is=new FileInputStream(file);
Movie.decodeStream(is);
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments