Camera always returns resultCode as 0

前端 未结 5 812
小蘑菇
小蘑菇 2021-01-04 10:40

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

5条回答
  •  臣服心动
    2021-01-04 11:11

    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

提交回复
热议问题