WorldMap is a simple Android app that displays a map of the world taken from Wikimedia (http://upload.wikimedia.org/wikipedia/commons/3/33/Physical_Political_World_Map.jpg), and allows the user to scroll around on it.
The map itself is quite large (6480,3888), so it's way too big to fit in memory all at once (6480 x 3888 x 32 / 8) = 100,776,960 -- over 96 megs. The VM heap size Android supports is eith 16 or 24 megs, so we can't fit the whole thing in memory at once.
So WorldMap uses the BitmapRegionDecoder API (available as of API 10) to decode just what it needs to display.
WorldMap is open source, and the source code is here:https://github.com/johnnylambada/WorldMap世界地图是一个简单的Android应用程序,显示采取来自维基(http://upload.wikimedia.org/wikipedia/commons/3/33/Physical_Political_World_Map.jpg)的世界地图,并允许用户左右滚动。
地图本身是相当大的(6480,3888),所以它的方式太大,无法一次(6480所述3888×32/8)= 100776960 - 超过96兆内存。 VM堆大小Android支持eith 16或24兆,所以我们可以在内存中的东西并不适合整个一次。
所以世界地图使用BitmapRegionDecoder的API(API 10)解码正是需要显示。
世界地图是开源的,源代码是在这里:https://github.com/johnnylambada/WorldMap