p-lr / MapView

A Fast, memory efficient Android library to display tiled maps, with support for markers, paths, and rotation.
Apache License 2.0
184 stars 38 forks source link

Support for .png deep zoom map #39

Closed AdminCarlos closed 10 months ago

AdminCarlos commented 1 year ago

Currently, i can't seem to use a deep zoom map generated in .png format. I get the following errors:

W/BitmapFactory: bitmap marked for reuse (131072 bytes) can't fit new bitmap (262144 bytes)

Is there no support for .png maps or am i doing something wrong?

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val mapView = this.findViewById<MapView>(R.id.mapview) ?: return

        val tileStreamProvider = TileStreamProvider {row, col, zoomLvl ->
            try {

                this.assets?.open("tiles/esp/$zoomLvl/$row/$col.png")

            }

            catch (e: Exception) {

                null

            }

        }

        val config = MapViewConfiguration(levelCount = 6, fullWidth = 8192, fullHeight = 8192, tileSize = 256, tileStreamProvider)/*.setMinimumScaleMode(MinimumScaleMode.FILL)*/

        mapView.configure(config)

    }
}

Thanks you.