Skip to main content

Images

2 replies [Last post]
plitanium
Offline
Joined: 2007-10-17
Points: 0

Hi everybody,

I'm developing an application in WTK and i just can't figure out how to display a simple image (not present in the phone) for an introduction when the application begins in the phone...
It'll be of great help if somebody could tell me how to go about it...

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sfitzjava
Offline
Joined: 2003-06-15
Points: 0

If you mean a splash screen type image then you can use the
javax.microedition.lcdui.Image.createImage() method. This is a static method and has 2 formats that would be useful in building a splash screen.
The first would take a byte[]. You would need to setup a HTTPConnection to the image stored on some server, and read in the image into a byte []. Also you will need to pass in the offset (most likely 0) and the length of the byte[].

The other format would take an InputStream. Here you would need to setup some type of socket to point to a server as the HTTPConnection would return other HTTP-ish stuff when you make the request to .getInputStream(), while a socket you can setup to just open the image file (png, bmp, or other supported formats), and copy the contents to the socket stream byte for byte.

There should be examples on the net for how to setup the exact code.

-Shawn

plitanium
Offline
Joined: 2007-10-17
Points: 0

and also to change its icon in the phone:)