here-android-sdk-examples: Why MapView is not working

Hi! Can anyone tell me why I need to set Map on MapView in order to set Map parameters like zoom or center?

private fun initMap() {
         MapEngine.getInstance().init(context) { error ->`
            when (error) {
                NONE -> {
                    map = Map()
                    mapView.map = map
                    map.setCenter(GeoCoordinate(51.919438, 19.145136), Animation.NONE)
                    map.zoomLevel = map.minZoomLevel + map.maxZoomLevel / 2
                }
                else -> context?.showToast(R.string.error_map_init)
            }
        }
    }

When I switch position of mapView.map = map and move it below map.zoomLevel my init is crashing with Attempt to invoke interface method 'void com.here.android.mpa.internal.br.c()' on a null object reference. Can you explain me how this is the case? Is setting map on MapView makes MapEngine somehow load data? Unfortunately the code is obfuscated and I cannot reverse-engineer it :C

Thanks for help!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments