wood burning stoves 2.0*
The moose likes Java Micro Edition and the fly likes Networking question from Jonathan Knudsen - Beginning J2ME.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Networking question from Jonathan Knudsen - Beginning J2ME.." Watch "Networking question from Jonathan Knudsen - Beginning J2ME.." New topic
Author

Networking question from Jonathan Knudsen - Beginning J2ME..

sab son
Greenhorn

Joined: Apr 26, 2006
Posts: 28
Hi Ranchers,

Need help with Li and Knudsen's 'Begining J2ME , from novice to professional'.

Chapter 10 - Image loader example (page 148).
In order to render the PNG image on the phone, ImageLoader -URL, MIDlet propert has to be modified to a valid PNG image a URL.

I used the URL as in the following code snippet:

public void run() {
HttpConnection hc = null;
DataInputStream in = null;

try {
String url = getAppProperty("http://r0k.us/graphics/images/4kSnake.png");
hc = (HttpConnection)Connector.open(url);
int length = (int)hc.getLength();
byte[] data = null;
if (length != -1) {
data = new byte[length];
in = new DataInputStream(hc.openInputStream());
in.readFully(data);
}...........

As the link given in book is not working. The code compiles with no issues but when I run this on my WTK25 simulator, at run time is complains of illegal argument exception. How do I change the MIDlet property ImageLoader-URL? to render the image on simulator or a real java device?

thanks,
-Sab
Girish Nagaraj
Ranch Hand

Joined: Apr 19, 2006
Posts: 153
1. select settings in the KToolbar
2. select user-defined tab & change URL

package application again
1. select project menu option
2. package --> create package
3. copy the jar file from bin folder to the real java device & run

Well google for some png images & try
sab son
Greenhorn

Joined: Apr 26, 2006
Posts: 28
Girish,

It worked !!!
thnx a tonne man, I am preparing for SCMAD, can I have your email for future questions in related field?

help is appreciated a lot man !!!
-Sab.
Girish Nagaraj
Ranch Hand

Joined: Apr 19, 2006
Posts: 153
You are Welcome!!

My mail Id: girish.thbs@gmail.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Networking question from Jonathan Knudsen - Beginning J2ME..
 
Similar Threads
send audio and text via one http connection?
Problem with servlet running on linux.
storing/retrieving image to/from database problems
Transfer Vector over HTTP
Networking question from Jonathan Knudsen - Beginning J2ME..