I've written a MIDlet that downloads an image to the phone by using an address. It works prefectly on the emulator but on the phone it won't use the DataInputStream. I've checked the phones MIDP and CLDC version and if any optional packages where being used but all is fine. I've tried it on 3 different phones and none work but it works on all emulators. Could it just be the connection? I left the MIDlet running on the phone for at least 10 minutes and nothing happens.
The phones did subscribe to data service and they did prompt to approve the network connection. I did check the server log file and there is no incoming connection, the log file does get an incoming connection from the emulator. Could it be the connection? I changed the http link in the code so it would download an image from www.o2.co.uk and the phone downloaded the image. Or is there some problem with the server?
private Image getImage() throws IOException
ContentConnection connection = (ContentConnection)Connector.open("http://flash.o2.co.uk/personal/homepage/images/k700.jpg");
DataInputStream iStrm = connection.openDataInputStream();
ByteArrayOutputStream bStrm = null;
Image im = null;
int length = (int) connection.getLength();
if (length != -1)
imageData = new byte[length];
bStrm = new ByteArrayOutputStream();
while ((ch = iStrm.read()) != -1)
imageData = bStrm.toByteArray();
im = Image.createImage(imageData, 0, imageData.length);
if (iStrm != null)
if (connection != null)
if (bStrm != null)
return (im == null ? null : im);
this connects to the site and downloads the image. but if I use my server nothing happens.