看板 AndroidDev 關於我們 聯絡資訊
小弟想要用Geocoder把經緯度轉成地址 可是使用geocoder.getFromLocation時每次都會跑出ERROR 請問是哪裡寫錯了嗎? 還是有什麼除了Internet以外的Permission public String getAddress(){ Geocoder gc = new Geocoder(this, Locale.ENGLISH); String place=null; try { List<Address> lstAddress = gc.getFromLocation(longitude, latitude,1); place = lstAddress.get(0).getLocality(); } catch (IOException e) { } return place; } 感謝~ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.133.36.13 ※ 文章網址: https://www.ptt.cc/bbs/AndroidDev/M.1426922071.A.2D6.html
passli: locat 錯誤是什麼? 03/21 22:06
liddle: 給個錯誤訊息是基本要求吧?很難隔空抓藥。 03/22 17:43
JULONE780701: 你把IO兩個字去掉就好了 03/23 09:08
issuemylove: lstAddress可能沒結果 你直接call get(0) so danger 03/23 15:24
issuemylove: ous 03/23 15:24
issuemylove: 另外你應該要先檢查 Geocoder.isPresent() 03/23 15:27