I am trying to develop using camera in my android application.
The problem is that the camera always returns a result code of 0, irrespective of if I press done or c
The issue (in android >= 5.0) might be with singleInstance
mode.
if you have your activity launchMode
set to singleInstance
, then in android < 5.0 you will receive cancelled result immediately. In android >=5.0 you will have resultCode == Activity.RESULT_CANCELED
.
Try using launchMode = singleTask
. It is much like singleInstance
, but allows other activities to be launched on the task.
More info here: https://developer.android.com/guide/topics/manifest/activity-element.html#lmode