Android movie import player gif image file exception Ioexception.reset

Source: Internet
Author: User

When you use movie to play an GIF picture, you can normally import a GIF file in assets, such as:

The code is as follows Copy Code

Is=context.getresources (). Openrawresource (R.drawable.mygif);
Movie = Movie.decodestream (IS);

However, when the network picture is loaded locally, the following error is reported:

The code is as follows Copy Code
At (
At (Native method)
At (
At (

I declared the permission in Androidmanifest.xml:

The code is as follows Copy Code

<uses-permission android:name= "Android.permission.INTERNET"/>
<uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/>


  code is as follows copy code

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);

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.