Hello,
my aim is to get an image from the server...
this is how i do it:
public void getimage(
String url) throws IOException
{
HttpConnection conn = null;
InputStream is = null;
int read=-1;
StringBuffer b=null;
try
{
conn = (HttpConnection)Connector.open(url);
is = conn.openInputStream();
b = new StringBuffer();
while ((read = is.read())>=0)
{
b.append((char)read);
}
image=Image.createImage(((b.toString()).getBytes()),0,((b.toString()).length()));
}
catch(SecurityException e)
{
e.printStackTrace();
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
if (is != null)
is.close();
if (conn != null)
conn.close();
}
}
now what i do is...to get an image i start a
Thread...
now the thread has already started...and say for example the user wants to stop the process of getting the current image...and wants to download another image....so the thread will start again...in such a case i would like the earlier process of getting the image to stop....but am not able to get through...
(J2ME DOSEN'T HAVE THE stop() METHOD)....
help appreciated
cheers
amal shah