os-fileup
os-fileup copied to clipboard
App crashes when I take picture from camera
When I select image from gallery, it works fine but when I select camera option, after taking picture and pressing ok, app crashes, I traced the issue to intent being null. App works fine on emulator but not on real devices.
can you help me with configs of your device?
Samsung s6 h+, android version 7.1 Huawei y9 prime, android 9.0
I have the exact same problem on my Samsung Galaxy S7 android 8.0 and OnePlus One android 6.0.1. My app is targeting sdk version 28. Anybody had any luck with solving this, or at least have an idea what could be the cause?
This stackoverflow answer gave me idea of what is wrong here: https://stackoverflow.com/questions/6982184/camera-activity-returning-null-android#answer-10230234
If you pass the extra parameter MediaStore.EXTRA_OUTPUT with the camera intent then camera activity will write the captured image to that path and it will not return the bitmap in the onActivityResult method.
So intent in onActivityResult should always be null since MediaStore.EXTRA_OUTPUT parameter is used in this code. In line 81 NullPointerException is thrown when calling intent.getClipData(). But it is ok because null == intent.getClipData() && null == intent.getDataString() is not necessary here. Though, problem might occure if variable cam_file_data is null too.
@MuhammadFaizan980 @urospodkriznik hello, can you guys test out the latest repo update? and do let us know your results.
@mgks hello again, I tested your latest repo update and in works nice now. Thank you!