• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Animated GIF images on a form

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All

I'm having trouble appending a animated GIF image on to a J2ME form,the image displays but it doesn't animate, does anyone know why and a method to make this work ? The code i used is stated below

img =Image.createImage("/download.gif");
item = new ImageItem(null,img,item.LAYOUT_CENTER,null);
f1.append(item);


Thanks
[ February 03, 2006: Message edited by: Zac Styris ]
 
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

First of all J2ME formally allows only .PNG image files (the .GIF etc are not supported).

So to create an animated "gif" you need to create several png images and then move between them in another thread.

Look at this example:

press here
 
Zac Styris
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply, i'll try that out.
 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does this program work?

Variables not define : imgIndex

Declaring int imgIndex = 0 or 1; doesnt work at all. Maybe the declaration of this variable has to be figured out.

Replaced the name MyCanvas with GIFCanvas creating GIFCanvas.java in the process.

This program throws java.lang.NullPointerException:

at GIFCanvas.paint(+23)
at javax.microedition.lcdui.Canvas.callPaint(+80)
at javax.microedition.lcdui.Display.repaint(+77)
at javax.microedition.lcdui.Display.registerNewCurrent(+237)
at javax.microedition.lcdui.Display.access$400(+6)
at javax.microedition.lcdui.Display$DisplayAccessor.foregroundNotify(+46)
at javax.microedition.lcdui.Display$DisplayManagerImpl.notifyWantsForeground(+152)
at javax.microedition.lcdui.Display$DisplayManagerImpl.access$100(+6)
at javax.microedition.lcdui.Display.setCurrentImpl(+115)
at javax.microedition.lcdui.Display.setCurrent(+29)
at GIFDemo.startApp(+24)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
at com.sun.midp.midlet.Scheduler.schedule(+270)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+116)


Rgds,

Seetesh
 
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic