gpt4 book ai didi

android - google map api v2从url android添加图标

转载 作者:太空狗 更新时间:2023-10-29 12:42:20 24 4
gpt4 key购买 nike

我有一个从网络服务中检索纬度和经度的项目,并将它们添加到谷歌地图标记中。我想为来自 url 的标记添加自定义图标。

    mMap.addMarker(new MarkerOptions()
.position(new LatLng(dlat,Dlong))
.title(m.group(9))
.draggable(false)
.snippet(m.group(1)+" "+m.group(10)));

如何从链接添加带有自定义图标的 .icon

最佳答案

Use this method and use returned bitmap to display in map





public Bitmap getBitmapFromURL(String imageUrl) {
try {
URL url = new URL(imageUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}

关于android - google map api v2从url android添加图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23732712/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com