Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

App crashes: Attempt to invoke virtual method 'android.graphics.Bitmap$Config android.graphics.Bitmap.getConfig()' on a null object reference #10507

Closed
uburoiubu opened this issue Nov 20, 2017 · 2 comments
Labels
Android Mapbox Maps SDK for Android

Comments

@uburoiubu
Copy link

Have this crash on some devices:

screen shot 2017-11-20 at 16 03 12

@fabian-guerra fabian-guerra added the Android Mapbox Maps SDK for Android label Nov 20, 2017
@tobrun
Copy link
Member

tobrun commented Nov 20, 2017

I can't really explain this crashlog, can you add some context/code on how the icon was created?

@uburoiubu
Copy link
Author

uburoiubu commented Nov 20, 2017

@tobrun, inside an Activity's OnCreate():

mapView.getMapAsync(new OnMapReadyCallback() {
            @Override
            public void onMapReady(final MapboxMap mapboxMap) {

                VehicleCardActivity.this.mapboxMap = mapboxMap;

                if (groupOfVehiclesQuery.get(0).getLatestNavItem() != null) {

                        IconFactory iconFactory = IconFactory.getInstance(VehicleCardActivity.this);
                        icon = iconFactory.fromResource(R.mipmap.car);

                        LatLng position = new LatLng();
                        position.setLatitude(groupOfVehiclesQuery.get(0).getLatestNavItem().getLatitude());
                        position.setLongitude(groupOfVehiclesQuery.get(0).getLatestNavItem().getLongitude());

                        latestNavigationMarker = new MarkerViewOptions().position(position)
                                .rotation(groupOfVehiclesQuery.get(0).getLatestNavItem().getDirection())
                                .icon(icon)
                                .anchor(0.5f, 0.5f)
                                .snippet(String.valueOf(groupOfVehiclesQuery.get(0).getPlate()!=null? groupOfVehiclesQuery.get(0).getPlate() : "Н/Д"));

                        mapboxMap.addMarker(latestNavigationMarker);

                        cameraPosition = new CameraPosition.Builder()
                                .target(position)
                                .zoom(13.0)
                                .build();

                        mapboxMap.setCameraPosition(cameraPosition);
                }
        });

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

4 participants