Google Maps API in Java ME
Here is a simple library to query Google Maps with the following features:
geocode addresses to their geographic coordinates
retrieve static images with given custom size, format and zoom
To see a live sample of this API, you can check here: Java ME Google Maps API sample MIDlet
Contents
[hide]
1 Get your own Google Maps API Key
2 Use a Proxy server to access Google Map services
3 Source code: GoogleMaps class
4 Utility method for map scrolling
5 Source code: sample usage
Get your own Google Maps API Key
NOTE: Usage of this code with the free Google Maps API Key breaks Google's Terms and Conditions (section 10.8). You should purchase an Enterprise License if you wish to use the Google Maps API as shown in this example.
To use the following code, you should get your own Google Maps API Key. If you have not an API key, you can follow the instructions here: How to use Google Maps data in mobile applications
Use a Proxy server to access Google Map services
Note: this subject (proxy usage) is probably non necessary, still investigating it..
When you sign up to obtain a Google Maps API key, you enter the address that will be able to access Maps services with that key. For this reason, you should setup a Proxy server on that address that will receive HTTP requests from your mobile clients, forwarding them to Google Maps services, giving back Google responses.
In the code below, you should forward the following requests:
http://www.yourserver.com/geo requests to http://maps.google.com/maps/geo
http://www.yourserver.com/staticmap requests to http://maps.google.com/staticmap
Source code: GoogleMaps class
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Vector;
import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;
import javax.microedition.lcdui.Image;
public class GoogleMaps {
private st
Ïà¹ØÎĵµ£º
Today , i take the first lesson of java ,let me sum up the details:
firstly,about jdk and jre.jdk stands for java development kit,while jre represent java Runtime Environment. jdk is the key of Java. And,jvm(java virtual machine) is the key of jre.
then ,about the platform independence of java.Dur ......
Java MailÎÞ·¨½âÎö´ø·ÖºÅµÄÊÕ¼þÈËÁбíµÄÎÊÌâ
½ñÌìͬÊÂÅöµ½Ò»¸öÎÊÌ⣬ʹÓÃJAVA MAILÊÕÈ¡Óʼþʱ£¬Èç¹ûÊÕ¼þÈËÊǸöÁÐ±í£¬ÇÒÊÕ¼þÈËÁбíÊÇÒԷֺŽøÐзָîµÄ£¬ÔòJAVA MAIL¾Í»á³öÏÖÒì³££¬²»ÄÜÕý³£½âÎö£¬³é¿Õ¿´ÁËÒ»ÑÛ£¬×Ô¼ºÐ´Á˸ö¼òµ¥demo£¬ºÜ¼òµ¥£¬ÀýÈ磺
@Test
public void te ......
¹ØÓÚJavaÄÚ´æ·ÖÅ䣬ºÜ¶àÎÊÌⶼģģºýºý£¬²»ÄÜÈ«Ãæ¹áͨÀí½â¡£½ñ²éÔÄ×ÊÁÏ£¬ÓûÇóÉîÈëÍÚ¾ò£¬³¹µ×ÀíÇåjavaÄÚ´æ·ÖÅäÂöÂ磬ֻÒòˮƽÓÐÏÞ£¬Ã»´ïµ½Ô¤ÆÚЧ¹û£¬½öÒÔ´ËÎĶÔËùÑо¿µ½Ö®´¦×÷ÒԼǼ£¬ÎªÒÔºóѧϰÌṩ²Î¿¼£¬±ÜÃâÖØÍ·ÔÙÀ´¡£
Ò»¡¢JavaÄÚ´æ·ÖÅä
1¡¢ JavaÓм¸ÖÖ´æ´¢ÇøÓò£¿
* ¼Ä´æÆ÷
-- ÔÚCP ......
¹À¼ÆÑ§Ï°javaµÄÂòÁËBruce Eckle¡¶Thinking In Java 4th Edition¡·µÄÐÂÊÖÃÇ£¨ÎÒÒ²ÊÇ£©£¬¹À¼Æ¶à»áÓöµ½Ò»¸öÎÊÌ⣺
±àÒëʱimport static net.mindview.util.Print.*;ÕÒ²»µ½ÏàÓ¦µÄ°ü£¬print·½·¨¾ÍÓò»ÁË¡£ÏÂÃæ°ÑÎҵIJÙ×÷·½·¨Ìù³öÀ´£¬Ï£ÍûÄܰﵽÄã¡£
1¡¢°ÑÊé±¾µÄÔ´´úÂë ......
1. ¸ÅÊö
±¾ÎÄÖ÷Òª°üÀ¨ÒÔϼ¸¸ö·½Ã棺±àÂë»ù±¾ÖªÊ¶£¬java£¬ÏµÍ³Èí¼þ£¬url£¬¹¤¾ßÈí¼þµÈ¡£
ÔÚÏÂÃæµÄÃèÊöÖУ¬½«ÒÔ"ÖÐÎÄ"Á½¸ö×ÖΪÀý£¬¾²é±í¿ÉÒÔÖªµÀÆäGB2312±àÂëÊÇ"d6d0 cec4"£¬Unicode±àÂëΪ"4e2d 6587"£¬UTF±àÂë¾ÍÊÇ"e4b8ad e69687"¡£×¢Ò⣬ÕâÁ½¸ö×ÖûÓÐiso8859-1±àÂ룬µ«¿ÉÒÔÓÃiso8859-1±àÂëÀ´"±íʾ"¡£
2. ±àÂë»ù±¾ÖªÊ ......