Monday, March 15, 2010

Display GIF image using J2me

Peace upon you,
displaying gif is a common problem in j2me if u search about it in google u will find many classes used to encode gif but it's simply as shown in this code:

player = Manager.createPlayer(getClass().getResourceAsStream("/Image path"),
"image/gif");
player.realize();

if ((vidc = (VideoControl) player.getControl("VideoControl")) != null) {
videoItem = (Item) vidc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null);
//vidc.setDisplaySize(240, 140);
}

append(videoItem);
midlet.getDisplay().setCurrent(this);
while (true) {
player.start();
}

Enjoy
Happy coding;-)

No comments: