Preview mode must have started before you can take a picture

Viktar Patotski

We are getting such stacktraces in our application using cwac-camera:

java.lang.IllegalStateException: Preview mode must have started before you can take a picture
at com.commonsware.cwac.camera.CameraView.takePicture(CameraView.java:329)
at com.commonsware.cwac.camera.CameraView.takePicture(CameraView.java:277)
at com.github.randoapp.camera.RandoCameraHost.onAutoFocus(RandoCameraHost.java:119)
at com.commonsware.cwac.camera.CameraView.onAutoFocus(CameraView.java:411)
at android.hardware.Camera$EventHandler.handleMessage(Camera.java:824)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
at dalvik.system.NativeStart.main(Native Method)

We believe that this can be happenning because of users pressing take picture too early. The solution is to disable button while preview is initializing and enable only when it's done. The question is: What event to use for button enabling? Is there event or callback sayong that preview is finally initialized?

CommonsWare

We believe that this can be happenning because of users pressing take picture too early

That is a distinct possibility.

What event to use for button enabling? Is there event or callback sayong that preview is finally initialized?

autoFocusAvailable() in your CameraHost is the best option at the moment. That is called just before the preview begins and inPreview is set to true.

I have filed an issue to do a better job than this.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Preview mode must have started before you can take a picture

From Dev

Android - Take picture without preview

From Dev

Sitecore "You must lock this item before you can edit" is missing

From Dev

Can we use takePicture() in android without camera preview? I need to take a picture secretly for security purposes

From Dev

Android: Preview picture after capture, before save

From Dev

Before you can run VMware several modules must be compiled

From Dev

SignalR self host: Connection must be started before data can be sent. Call .start() before .send()

From Dev

Can you make a function take more than one type in Elm? Can you have an overloaded function?

From Dev

Camera.PictureCallback stop preview after take a picture

From Dev

Error while sending Email :you must load or assign this property before you can read its value -EWS

From Dev

Can I securely take a picture on iOS?

From Java

Keyboard shortcut to take file out of preview mode in VSCode

From Dev

You must register this ParseObject subclass before instantiating it

From Dev

TestDisk "You have to reboot for the change to take efferct"

From Dev

Before you login you must answer me these questions 3?

From Dev

How to take a picture using a webcam and have the picture uploaded directed or automatically into my php form

From Dev

How to take a picture using a webcam and have the picture uploaded directed or automatically into my php form

From Dev

The project needs to be deployed before it can be started

From Dev

In C# MVC can you set a global behavior which each action method must carry out before processing the rest of the request?

From Dev

Installing glib gives "You must have either have gettext support"

From Dev

How can i get the path after i take a picture?

From Dev

Android Camera2 : can't take picture with front camera

From Dev

Can't save in gallery after take picture using FileProvider

From Dev

Picture Preview page in coldfusion

From Dev

Pygame - blitting for a preview picture

From Dev

Picture Preview page in coldfusion

From Dev

Pygame - blitting for a preview picture

From Dev

Gaming on Ubuntu - How far can you take it?

From Dev

How to resolve "You have not started an Objectify context" in JUnit?

Related Related

  1. 1

    Preview mode must have started before you can take a picture

  2. 2

    Android - Take picture without preview

  3. 3

    Sitecore "You must lock this item before you can edit" is missing

  4. 4

    Can we use takePicture() in android without camera preview? I need to take a picture secretly for security purposes

  5. 5

    Android: Preview picture after capture, before save

  6. 6

    Before you can run VMware several modules must be compiled

  7. 7

    SignalR self host: Connection must be started before data can be sent. Call .start() before .send()

  8. 8

    Can you make a function take more than one type in Elm? Can you have an overloaded function?

  9. 9

    Camera.PictureCallback stop preview after take a picture

  10. 10

    Error while sending Email :you must load or assign this property before you can read its value -EWS

  11. 11

    Can I securely take a picture on iOS?

  12. 12

    Keyboard shortcut to take file out of preview mode in VSCode

  13. 13

    You must register this ParseObject subclass before instantiating it

  14. 14

    TestDisk "You have to reboot for the change to take efferct"

  15. 15

    Before you login you must answer me these questions 3?

  16. 16

    How to take a picture using a webcam and have the picture uploaded directed or automatically into my php form

  17. 17

    How to take a picture using a webcam and have the picture uploaded directed or automatically into my php form

  18. 18

    The project needs to be deployed before it can be started

  19. 19

    In C# MVC can you set a global behavior which each action method must carry out before processing the rest of the request?

  20. 20

    Installing glib gives "You must have either have gettext support"

  21. 21

    How can i get the path after i take a picture?

  22. 22

    Android Camera2 : can't take picture with front camera

  23. 23

    Can't save in gallery after take picture using FileProvider

  24. 24

    Picture Preview page in coldfusion

  25. 25

    Pygame - blitting for a preview picture

  26. 26

    Picture Preview page in coldfusion

  27. 27

    Pygame - blitting for a preview picture

  28. 28

    Gaming on Ubuntu - How far can you take it?

  29. 29

    How to resolve "You have not started an Objectify context" in JUnit?

HotTag

Archive