Skip to main content

gif-image in lwuit

7 replies [Last post]
transducer
Offline
Joined: 2007-10-14
Points: 0

hi,

is there a way to load an *.gif image in lwuit?

on normal way, it does'nt run...

code:
------------------------------------------------------------------------------------------------------------------------
InputStream is = Connector.openInputStream(extern_gif_path);
Image img = Image.createImage(is);
Label icon = new Label(img);
------------------------------------------------------------------------------------------------------------------------
(i cant't change image-format, it's a foreign resource)

many thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chen

Hi,
If your gif is an animated gif, use the resource editor utility to load
it (use the Animation tab).
You can use your code below only if the underlying platform support gif
images.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> hi,
>
> is there a way to load an *.gif image in lwuit?
>
> on normal way, it does'nt run...
>
> code:
> ------------------------------------------------------------------------------------------------------------------------
> InputStream is = Connector.openInputStream(extern_gif_path);
> Image img = Image.createImage(is);
> Label icon = new Label(img);
> ------------------------------------------------------------------------------------------------------------------------
> (i cant't change image-format, it's a foreign resource)
>
> many thanks
> [Message sent by forum member 'transducer' (transducer)]
>
> http://forums.java.net/jive/thread.jspa?messageID=287896
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

transducer
Offline
Joined: 2007-10-14
Points: 0

thanks chen.

it isn't an animated gif. it's a normal picture like this: http://www.google.com/intl/de_ALL/images/logo.gif

what can i do? is there no way to load a static-gif direct?

thanks

Message was edited by: transducer

chen

Check if your device supports gifs, if it does simply use your snippet code,
if it doesn't just save the image as png and load it locally.

Chen

lwuit-users@mobileandembedded.org wrote:
> thanks chen.
>
> it isn't an animated gif. it's a normal picture like this: http://www.google.com/intl/de_ALL/images/logo.gif
>
> what can i do?
>
> thanks
> [Message sent by forum member 'transducer' (transducer)]
>
> http://forums.java.net/jive/thread.jspa?messageID=287908
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

transducer
Offline
Joined: 2007-10-14
Points: 0

it does'nt work on swt 3.3 emulator (while loading the image)...

java.io.IOException
- javax.microedition.lcdui.ImageDataFactory.createImageFromStream(), bci=113
- javax.microedition.lcdui.ImageDataFactory.createImmutableImageData(), bci=11
- javax.microedition.lcdui.Image.createImage(), bci=20
- com.sun.lwuit.Image.createImage(), bci=5

edit: device htc-touch

Message was edited by: transducer

Message was edited by: transducer

chen

Check this url:
http://www.ddj.com/mobile/184406435;jsessionid=H4O5ZCXPQAETGQSNDLRSKHSCJ...

lwuit-users@mobileandembedded.org wrote:
> it does'nt work on swt 3.3 emulator (while loading the image)...
>
> java.io.IOException
> - javax.microedition.lcdui.ImageDataFactory.createImageFromStream(), bci=113
> - javax.microedition.lcdui.ImageDataFactory.createImmutableImageData(), bci=11
> - javax.microedition.lcdui.Image.createImage(), bci=20
> - com.sun.lwuit.Image.createImage(), bci=5
> [Message sent by forum member 'transducer' (transducer)]
>
> http://forums.java.net/jive/thread.jspa?messageID=287911
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

transducer
Offline
Joined: 2007-10-14
Points: 0

many thanks chen!

transducer
Offline
Joined: 2007-10-14
Points: 0

It seems a problem in swt 3.3... on my "se w960i" it woks beautiful (jpg + gif). on swt 3.3 there is an exception while loading (not displaying!) a gif.

but this fact is curious:

on swt 3.3: the flag gifSupported was true
on w 960i: the flag gifSupported was false

tested with:
http://www.ddj.com/mobile/184406435?pgno=1#l1

Message was edited by: transducer