Runtime error camera take picture

when i take picture with camera, and display it on imageview shows rudntime error
attempt to invoke virtual method ‘void’
on a null object reference

Can you show some blocks? Right now from the error statement I can only say that an empty value is passed Instead of image) . It just a guess though. Your blocks would provide a clear idea!

that only happen in samsung device, on my xiaomi device it works normally
and in xiaomi android oreo device the imageview didn’t show the image, but the image was there
i’m using botomsheet to choose between using image from gallery or camera

my minimum api setting was api 16, but then i increase the minimum api setting to android 5.0
but there was same result

I don’t have much experience with bottom sheet. But up-to what I know, by default the bottom sheet remains hidden and you have to drag it upwards every-time to see its content.
So as the bottom sheet is hidden, it may happen that, the image-view is not able to get the picture you are passing to it after clicking with the camera.

Try arranging your image-view in any other normal layout (vertical or horizontal) and then pass it, the picture clicked with camera. Check if the error still persist. :+1:

sorry for late response, if there was an error on the logic then the apk should not be running on other device, but it was running fine on mine and my friends xiaomi phone, but when run on samsung phone it return the error, and when run on small screen device the image doesn’t show at all, but the value was there i can upload the image, but the image itself doesn’t show at all on the phone



thanks your solution fixed my problem