第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在android上向谷歌地圖添加坐標(biāo)

在android上向谷歌地圖添加坐標(biāo)

至尊寶的傳說 2022-07-20 20:29:39
我已經(jīng)從一個 URL 解析了一些 XML 數(shù)據(jù),以顯示在 Android 設(shè)備上的列表視圖中。由于本網(wǎng)站上人們的一些研究和幫助,它按預(yù)期工作。我現(xiàn)在想要做的是獲取這些坐標(biāo)并將地圖添加到我的項目中并創(chuàng)建一個單擊事件偵聽器函數(shù),以便當(dāng)我單擊一組特定的數(shù)據(jù)時它可以顯示在地圖上......我不是確定如何繼續(xù)進(jìn)行此操作。我最終希望可以選擇一次選擇一個以在地圖上查看,以及具有所有坐標(biāo)的更大地圖視圖我將發(fā)布我當(dāng)前的結(jié)果和為我獲取 XML 數(shù)據(jù)的代碼。任何幫助將不勝感激。當(dāng)前結(jié)果項目類的一部分public void setLat(Double lat) {        this.lat = lat;    }    public Double getLon() {        return lon;    }    public void setLon(Double lon) {        this.lon = lon;    }    @Override    public String toString() {        return (new StringBuilder()).append("title: \n").append(title).append("\n")                .append("link: ").append(link).append("\n")                .append("geo-lat: ").append(lat).append("\n")                .append("geo-lon: ").append(lon).toString();    }}主要活動課的一部分   } else if (xpp.getName().equalsIgnoreCase("geo:lat")) {                    if (insideItem) {                        //extract the text between <geo:lat> and </geo:lat>                        item.setLat(Double.valueOf(xpp.nextText()));                    }                } else if (xpp.getName().equalsIgnoreCase("geo:long")) {                    if (insideItem) {                        //extract the text between <geo:lat> and </geo:lat>                        item.setLon(Double.valueOf(xpp.nextText()));                    }                }            }我只是不知道如何使用這些返回值在我的 android 項目中填充地圖
查看完整描述

1 回答

?
呼如林

TA貢獻(xiàn)1798條經(jīng)驗 獲得超3個贊

您需要生成一個 Google Maps API 密鑰。


放置一個 ImageView 并將此 URL 加載到該 ImageView 中:


https://maps.google.com/maps/api/staticmap?center=latitude,longitude&zoom=15&size=1280x720&sensor=false&markers=latitude,longitude&key=YOUR_API_KEY


在你的按鈕上OnClickListener():


String uri = String.format(Locale.ENGLISH, "geo:%f,%f?q=%f,%f",

                    latitude,

                    longitude,

                    latitude,

                    longitude);

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));

startActivity(intent);

這會將 Google 地圖應(yīng)用程序打開到這些坐標(biāo)。


查看完整回答
反對 回復(fù) 2022-07-20
  • 1 回答
  • 0 關(guān)注
  • 67 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號