Android examples for Map:Google Map
Get Address from Google.cn
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; public class Main { public static String GetAddr(String latitude, String longitude) { String addr = ""; String url = String .format("http://ditu.google.cn/maps/geo?output=csv&key=abcdef&q=%s,%s", latitude, longitude); URL myURL = null;//ww w. ja v a 2 s. c om URLConnection httpsConn = null; try { myURL = new URL(url); } catch (MalformedURLException e) { e.printStackTrace(); return null; } try { httpsConn = (URLConnection) myURL.openConnection(); if (httpsConn != null) { InputStreamReader insr = new InputStreamReader( httpsConn.getInputStream(), "UTF-8"); BufferedReader br = new BufferedReader(insr); String data = null; if ((data = br.readLine()) != null) { String[] retList = data.split(","); if (retList.length > 2 && ("200".equals(retList[0]))) { addr = retList[2]; } else { addr = ""; } } insr.close(); } } catch (IOException e) { e.printStackTrace(); return null; } return addr; } }