Back

GIF Apk Considerations

Due to a restriction of the Android filesystem, compiled APKs can not play GIFs from the installed assets folder. Similar to how video, sound, and databases must be extracted before use in compiled APKs.

When developing this plugin I wanted the transition between DroidScript IDE and compiled APKs to be transparent without a hassle to the developer.

For this to be possible it is highly recommended you use the following folder structure and the gif.GetGifPath( NameOfGIFwithoutExtension ) method. If you do so you will see no difference in compiled and IDE apps, they will display and run the same.

Where do I put my GIF files?

Under your app folder in the DroidScript IDE create a new folder named 'Gif'. So, for example, if your app was called MyNewApp:

/sdcard/DroidScript/MyNewApp


Here you will find a few folders (Img, Html, etc) and your app's html or js file (MyNewApp.js).

Create a new folder named:
Gif


This is case sensitive and must be 'Gif', not 'GIF'. Copy the GIF files you want to use in your app to this new folder. They should all have the file extension '.gif' (ie: spinner.gif, loader.gif, etc.gif).

When creating the GIF Image object, the simplest method would be:

Example - Create GIF Image Object

gifImage = gif.CreateGifImage( gif.GetGifPath( 'spinner' ), .5, .5);
  Copy  

Using this folder structure and the GetGifPath method allows the plugin to automatically extract your GIFs and use them from inside your compiled APKs.

Enjoy using animated GIFs in your DroidScript apps!