hi everyone
i want to make mymap show to mobile screen.
i using to google map
my map page is : http://www.hendekgenctiyatro.com/mobile_kmeans.php
my code is not show mymap to mobile screen
private String url2="http://www.hendekgenctiyatro.com/mobile_kmeans.php?";
public void run()
{
try {
Image image = get_map2(url2);
myItem = new ImageItem(null, image, 0, null);//If we get an image, we show it at screen.
}
catch (IOException ioe) {
myItem = new StringItem(null, ioe.toString());//If we could not get image from our get_map() method, we show a string which includes the exception.
}
kmeans.append(myItem);
kmeans.addCommand(mainbackCommand2);
display.setCurrent(kmeans);
HttpConnection connection1 = null;
try {
try {
connection1 = (HttpConnection) Connector.open(url2);
//connection = (HttpConnection) Connector.open("http://www.hendekgenctiyatro.com/gps_mapping.php?"+"&user_id="+user_id+"&lalt="+double_lat+"&longt="+double_lon+"&alt="+alt+"&speed="+result_speed);
connection1.setRequestMethod(HttpConnection.GET);
if (connection1.getResponseCode()!=connection1.HTTP_OK){
System.out.println("Connection failed!");
}
else {
System.out.println("Connection established!");
}
}
catch(Exception e) {}
}
catch(Exception e){}
finally {
try {
connection1.close();
}
catch(Exception io){}
}
}
public Image get_map2(String url2) throws IOException {
HttpConnection connection1 = null;//We create a HttpConnection. We could use StreamConnection instead of that also.
DataInputStream dis1 = null;//We get image file byte by byte, so we need a data input stream to get bytes.
try {
connection1 = (HttpConnection) Connector.open(url2);
int length = (int) connection1.getLength();//We get the files lengt by gettin connections length.
byte[] data = new byte[length];
//Creating a byte array which length is length of our image file to store the bytes which will be received from connection.
dis1 = new DataInputStream(connection1.openInputStream());//Receiving data by DataInputStream from connection.
dis1.readFully(data);
//reading data from data inputstream and pushing bytes to our byte array.We could use 'read' instead of 'readFully' but readFully is better.
return Image.createImage(data, 0, data.length);
//Creating entire image object from our byte array.
} finally {
if (connection1 != null)
connection1.close();
if (dis1 != null)
dis1.close();
}
}