Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying images dinamically

 
Javier Gomez
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Does anybody know if it is possible to develope a client application which receives a png image from the server and later displays it?
Until now, I have displayed images storing them in a jar file. But I would like to show them dinamically, like a map-client-app, in which you select a city and the server returns the proper map.
Thanks in advance,
Javier G�mez
 
Mark Herschberg
Sheriff
Posts: 6037
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That should certainly be possible. J2ME supports HTTP (particular implementations may support other protocols), so you can download images using HTTP. You can certainly store them in your running program to be displayed later. You should also be able to write the image to a file and read it back in, such as during a later run of the program.
--Mark
hershey@vaultus.com
 
chanoch wiggers
Author
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it sounds like you would need to do this at socket level at the moment, I guess it depends on what J2ME platform you are running. Basically, easiest (for me anyway) is to open a socket to the server and point it at a servlet (the connection string you give will do this e.g. socket://www.myhost.com:8080). Open an input stream and an output stream to the server. Send a GET/ request to the server. The servlet then renders the image for you and returns it across your socket of connection. You pick it up - make sure that you read it as binary (probably a byte at a time) and that your system and the client systems done have differing default encoding or that you specify the encoding correctly and then display the image. Depending on the platform you may wish to save it to memory before using
it certainly possible
 
Javier Gomez
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
Thanx a lot for your replies. But I found a very handy source code in da link below. Let�s have a look.
http://www.corej2me.com/SourceCode/downloadPng/index.htm
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic