2014-09-22 25 views
3

當我點擊Google地圖上的圖標時,我想要學院,公司,商家名稱及其地址。當在Android上的圖標上點擊時獲取完整詳細信息Google地圖

例如: - 在Google地圖應用程序上,當點擊圖標時,它會顯示該圖標的完整詳細信息和地址。

找到三個圖像。當我點擊「HealthCare Global Enterprise Ltd.」時,圖標,然後在屏幕頂部顯示帶有醫院名稱的完整地址。

我正在使用Geocoder獲取特定緯度和經度的地址。我得到街道,國家,pincode等,但無法獲得學院,公司,企業名稱。

這裏醫院名稱:醫療保健全球企業有限公司

代碼: -

private String getCompleteAddressString(double LATITUDE, double LONGITUDE) { 
    String strAdd = ""; 
    Geocoder geocoder = new Geocoder(this, Locale.getDefault()); 
    StringBuilder strReturnedAddress = null; 
    try { 
     List<Address> addresses = geocoder.getFromLocation(LATITUDE, LONGITUDE, 1); 
     if (addresses != null) { 
      System.out.println("Address Size ->>: " + addresses.size()); 
      System.out.println("Address 0th Position ->>: " + addresses.get(0)); 
      Address returnedAddress = addresses.get(0); 
      strReturnedAddress = new StringBuilder(""); 

      for (int i = 0; i < returnedAddress.getMaxAddressLineIndex(); i++) { 
       strReturnedAddress.append(returnedAddress.getAddressLine(i)).append("\n"); 

       System.out.println("*****************************"); 
       System.out.println("Admin Area: ->> " + returnedAddress.getAdminArea()); 
       System.out.println("Country Code: ->> " + returnedAddress.getCountryCode()); 
       System.out.println("Country Name: ->> " + returnedAddress.getCountryName()); 
       System.out.println("Feature Name: ->> " + returnedAddress.getFeatureName()); 
       System.out.println("Admin Area: ->> " + returnedAddress.getLatitude()); 
       System.out.println("Latitude: ->> " + returnedAddress.getLocality()); 
       System.out.println("Longitude: ->> " + returnedAddress.getLongitude()); 
       System.out.println("Max Address Line Index: ->> " + returnedAddress.getMaxAddressLineIndex()); 
       System.out.println("Phone: ->> " + returnedAddress.getPhone()); 
       System.out.println("PostalCode: ->> " + returnedAddress.getPostalCode()); 
       System.out.println("Premises: ->> " + returnedAddress.getPremises()); 
       System.out.println("SubAdminArea: ->> " + returnedAddress.getSubAdminArea()); 
       System.out.println("SubLocality: ->> " + returnedAddress.getSubLocality()); 
       System.out.println("SubThoroughfare: ->> " + returnedAddress.getSubThoroughfare()); 
       System.out.println("Thoroughfare: ->> " + returnedAddress.getThoroughfare()); 
       System.out.println("Url: ->> " + returnedAddress.getUrl()); 
       System.out.println("*****************************"); 
      } 
      strAdd = strReturnedAddress.toString(); 
      Log.w("My Current loction address", "" + strReturnedAddress.toString()); 
     } else { 
      Log.w("My Current loction address", "No Address returned!"); 
     } 
    } catch (Exception e) { 
     strReturnedAddress.append("Address Not Avilable"); 
     strAdd = strReturnedAddress.toString(); 
    } 
    return strAdd; 
} 

enter image description here enter image description here enter image description here

+0

這是你想要知道嗎?http://stackoverflow.com/questions/2273207/using-google-maps-api-to-get-address-of-business – Dhina 2014-09-30 09:54:04

+0

不..我的問題很清楚...當你打開谷歌地圖應用程序,那麼你會看到很多的圖標在那裏。如醫院,學校,研究所,商店等。當您點擊該圖標,然後在地圖的頂部,您將看到該圖標的名稱和完整地址。 – 2014-09-30 11:54:47

+0

http://wptrafficanalyzer.in/blog/showing-nearby-places-and-place-details-using-google-places-api-and-google-maps-android-api-v2/ 可能是這樣?與地方API。您將需要一個Places API密鑰 – Dhina 2014-09-30 12:34:38

回答

0

take a look at Google API picker可確定哪些谷歌API使用是有幫助獲取你正在尋找的數據。根據你的問題,它看起來像你想要一個位置的業務或公司名稱,以及其他細節。它可以通過Google Place API獲得,下面是它的總結。

"Get the name, address, opening hours, and other details of a place, including customer ratings and reviews."

這是REST類型的API,你可以提供的位置座標,並取回細節JSON。請參閱此SO question and answer for a sample code snippet

相關問題