2017-06-01 69 views
1

我想打開谷歌地圖時,我有地址:當我有一個國家,城市,街道,建築物數量。我只能打開一個谷歌地圖,當我有一個經緯度。我如何做到這一點?Java android打開谷歌地圖與地址

+0

沒有人知道。全部取決於你的代碼。 –

+0

@VladMatvienko,但我可以將整個地址geogoding到緯度?或者我可以用地址打開谷歌地圖; Polska,克拉科夫,Teligi 13? –

+1

你可以同時做這兩件事。獲取地址的經緯度:https://www.google.com.ua/search?q=android+get+latitude+and+longitude+from+address&oq=android+get+latitude+and+longitude+ &aqs = chrome.4.69i57j0l5.8479j0j7&sourceid = chrome&ie = UTF-8。要打開地圖,請使用以下地址:https://www.google.com.ua/search?q=android+get+latitude+and+longitude+from+address&oq=android+get+latitude+and+longitude+&aqs=chrome .4.69i57j0l5.8479j0j7&的SourceID =鉻&即= UTF-8#安全=關閉&q =機器人+開放+谷歌地圖+ + +用的+地址 –

回答

4

您可以通過座標得到利用地理編碼後開放谷歌地圖從ADRESS座標

類似的東西

當你擁有所有
mMap = ((SupportMapFragment) getSupportFragmentManager() 
      .findFragmentById(R.id.map)).getMap(); 

    Log.v("ddd", mAddress); 

    Geocoder geocoder = new Geocoder(this, Locale.getDefault()); 
      //To initialice list of address 
    List<Address> addresses = null; 
    try { 
        //To put the address in list 
     addresses = geocoder.getFromLocationName(mAddress, 1); 
    } catch (IOException e) { 
     // TODO Auto-generated catch block 
     e.printStackTrace(); 
    } 
      //Get Latitude and longitude 
    Address address = addresses.get(0); 
    mLongitude = address.getLongitude(); 
    mlatitude = address.getLatitude(); 
1
Here it's really simple to launch google maps from your application: 
//geo:0,0 if you don't have lat/lng for the location and just wanna search using address. 

Uri gmmIntentUri = Uri.parse("geo:0,0?q=pass the address here"); 
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); 
//set package to "com.google.android.apps.maps" so that only google maps is opened. 
mapIntent.setPackage("com.google.android.apps.maps"); 
startActivity(mapIntent);