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
Ïà¹ØÎĵµ£º
java.util°üÖоͰüº¬ÁËһϵÁÐÖØÒªµÄ¼¯ºÏÀ࣬¶ø¶ÔÓÚ¼¯ºÏÀ࣬Ö÷ÒªÐèÒªÕÆÎյľÍÊÇËüµÄÄÚ²¿½á¹¹£¬ÒÔ¼°±éÀú¼¯ºÏµÄµü´úģʽ¡£
½Ó¿Ú£ºCollection
ËùÓм¯ºÏÀàµÄ¸ùÀàÐÍ£¬Ö÷ÒªµÄÒ»¸ö½Ó¿Ú·½·¨£ºboolean add(Ojbect c)Ëä·µ»ØµÄÊÇboolean£¬µ«²»ÊDZíʾÌí¼Ó³É¹¦Óë·ñ£¬ÒòΪCollection¹æ¶¨£ºÒ»¸ö¼¯ºÏ¾Ü¾øÌí¼ÓÕâ¸öÔªËØ£¬ÎÞÂÛʲôÔÒò£¬¶¼± ......
Java MailÎÞ·¨½âÎö´ø·ÖºÅµÄÊÕ¼þÈËÁбíµÄÎÊÌâ
½ñÌìͬÊÂÅöµ½Ò»¸öÎÊÌ⣬ʹÓÃJAVA MAILÊÕÈ¡Óʼþʱ£¬Èç¹ûÊÕ¼þÈËÊǸöÁÐ±í£¬ÇÒÊÕ¼þÈËÁбíÊÇÒԷֺŽøÐзָîµÄ£¬ÔòJAVA MAIL¾Í»á³öÏÖÒì³££¬²»ÄÜÕý³£½âÎö£¬³é¿Õ¿´ÁËÒ»ÑÛ£¬×Ô¼ºÐ´Á˸ö¼òµ¥demo£¬ºÜ¼òµ¥£¬ÀýÈ磺
@Test
public void te ......
¹ØÓÚJavaÄÚ´æ·ÖÅ䣬ºÜ¶àÎÊÌⶼģģºýºý£¬²»ÄÜÈ«Ãæ¹áͨÀí½â¡£½ñ²éÔÄ×ÊÁÏ£¬ÓûÇóÉîÈëÍÚ¾ò£¬³¹µ×ÀíÇåjavaÄÚ´æ·ÖÅäÂöÂ磬ֻÒòˮƽÓÐÏÞ£¬Ã»´ïµ½Ô¤ÆÚЧ¹û£¬½öÒÔ´ËÎĶÔËùÑо¿µ½Ö®´¦×÷ÒԼǼ£¬ÎªÒÔºóѧϰÌṩ²Î¿¼£¬±ÜÃâÖØÍ·ÔÙÀ´¡£
Ò»¡¢JavaÄÚ´æ·ÖÅä
1¡¢ JavaÓм¸ÖÖ´æ´¢ÇøÓò£¿
* ¼Ä´æÆ÷
-- ÔÚCP ......
Ê×ÏÈboolean²»ÄܸúÆäËûÀàÐÍת»»¡£
1.¸³ÖµÊ±£º
ÕûÊýĬÈϵÄÊÇint ¸¡µãĬÈÏÊÇdouble£¬¼´ÕûÐ͵ȺÅÓÒ²àÈ«²¿×Ô¶¯×ª»¯Îªint£¬¸¡µãÐ͵ȺÅÓÒ²à×Ô¶¯×ª»»Îªdouble¡£µ±´óÈÝÁ¿µÄÊý¾ÝÀàÐ͸³Öµ¸øСÈÝÁ¿µÄÊý¾ÝÀàÐÍʱ ÐèҪǿÖÆÀàÐÍת»»µ«ÊÇÓÐ ......