New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapsforge NullPointer exception while cleaning map #846

Closed
mendinskis opened this Issue Jun 28, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@mendinskis

mendinskis commented Jun 28, 2016

I'm using mapsforge 0.6.0 version. I have a fragment where I put my map. I also add pointers into the map. When I open new fragment most of the time app crash and gives me

 java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
                                                                                                    at org.mapsforge.map.android.graphics.AndroidBitmap.getWidth(AndroidBitmap.java:114)
                                                                                                    at org.mapsforge.map.layer.overlay.Marker.draw(Marker.java:72)
                                                                                                    at org.mapsforge.map.layer.LayerManager.doWork(LayerManager.java:90)
                                                                                                    at org.mapsforge.map.util.PausableThread.run(PausableThread.java:140)

I noticed that in version 0.6.1 this is fixed however I need to use 0.6.0. Is it possible to be fixed? Thank you

here's my onDestroy method


@Override
    protected void onDestroy() {
        mapView.destroyAll();
        AndroidGraphicFactory.clearResourceMemoryCache();
        super.onDestroy();
    }

I also noticed that if I clear layers manually app gives this exception more rarely (but still the problem exists)

@Override
    protected void onDestroy() {
        mapView.getLayerManager().getLayers().clear();
        mapView.destroyAll();
        AndroidGraphicFactory.clearResourceMemoryCache();
        super.onDestroy();
    }
@devemux86

This comment has been minimized.

Show comment
Hide comment
@devemux86

devemux86 Jun 28, 2016

Collaborator

I don't know your implementation or what's called when the exception happens.
Following Getting-Started-Android-App guide for Mapsforge life cycle is usually the safest way.

And it's always recommended to advance to newest release for having all the latest improvements & fixes.

Plus we don't have the resources to support but the latest release.

Collaborator

devemux86 commented Jun 28, 2016

I don't know your implementation or what's called when the exception happens.
Following Getting-Started-Android-App guide for Mapsforge life cycle is usually the safest way.

And it's always recommended to advance to newest release for having all the latest improvements & fixes.

Plus we don't have the resources to support but the latest release.

@devemux86 devemux86 closed this Jul 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment