gpt4 book ai didi

java - 将大图像加载到 Google map 中

转载 作者:行者123 更新时间:2023-12-02 12:22:04 24 4
gpt4 key购买 nike

在我的应用程序中,我需要制作一张大 map 。我使用此代码将 map 图像作为地面叠加层加载到 Google map 。

GroundOverlayOptions newarkMap = new GroundOverlayOptions() 
.position(new LatLng(0, 0), 27000000f, 12735849f)
.image(BitmapDescriptorFactory.fromResource(R.drawable.map3));
googleMap.addGroundOverlay(newarkMap);

但是,在使用 map 多次输入 fragment 后,我收到 OOM 异常。

java.lang.OutOfMemoryError: Failed to allocate a 134217740 byte allocation with 16777216 free bytes and 37MB until OOM

那么,有什么办法可以将大图片加载到Google map 上吗?

最佳答案

不要加载整个图像 - 使用 TileProvider就像 this Alex Vasilkov的回答

关于java - 将大图像加载到 Google map 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45697995/

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