Community

Android sample app crashes when changing from portrait to landscape Answered

Hello, just short question; should the camera recognition also work on landscape mode in Android?

I've compiled the sample code and now have tested out the code in two devices and in both the sample crashes when device changes from portrait to landscape orientation.

I have included devices log below. Thanks!

08-04 12:01:15.504 4711 4711 D AndroidRuntime: Shutting down VM 08-04 12:01:15.505 4711 4711 E AndroidRuntime: FATAL EXCEPTION: main 08-04 12:01:15.505 4711 4711 E AndroidRuntime: Process: com.abbyy.rtr.sample.textcapture, PID: 4711 08-04 12:01:15.505 4711 4711 E AndroidRuntime: java.lang.RuntimeException: setParameters failed 08-04 12:01:15.505 4711 4711 E AndroidRuntime: at android.hardware.Camera.native_setParameters(Native Method) 08-04 12:01:15.505 4711 4711 E AndroidRuntime: at android.hardware.Camera.setParameters(Camera.java:2013) 08-04 12:01:15.505 4711 4711 E AndroidRuntime: at com.abbyy.mobile.sample.MainActivity.setCameraFocusMode(MainActivity.java:398) 08-04 12:01:15.505 4711 4711 E AndroidRuntime: at com.abbyy.mobile.sample.MainActivity.configureCameraAndStartPreview(MainActivity.java:609) 08-04 12:01:15.505 4711 4711 E AndroidRuntime: at com.abbyy.mobile.sample.MainActivity.setCameraPreviewDisplayAndStartPreview(MainActivity.java:409) 08-04 12:01:15.505 4711 4711 E AndroidRuntime: at com.abbyy.mobile.sample.MainActivity.access$800(MainActivity.java:46) 08-04 12:01:15.505 4711 4711 E AndroidRuntime: at com.abbyy.mobile.sample.MainActivity$3.surfaceChanged(MainActivity.java:251) 08-04 12:01:15.505 4711 4711 E AndroidRuntime: at android.view.SurfaceView.updateWindow(SurfaceView.java:613) 08-04 12:01:15.505 4711 4711 E AndroidRuntime: at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:184) 08-04 12:01:15.505 4711 4711 E AndroidRuntime: at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944) 08-04 12:01:15.505 4711 4711 E AndroidRuntime: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2186) 08-04 12:01:15.505 4711 4711 E AndroidRuntime: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1207) 08-04 12:01:15.505 4711 4711 E AndroidRuntime: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6320) 08-04 12:01:15.505 4711 4711 E AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:862) 08-04 12:01:15.505 4711 4711 E AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:674)

Was this article helpful?

0 out of 0 found this helpful

Comments

2 comments

  • Avatar
    Oksana Serdyuk

    RTR SDK supports all camera orientations with both free and commercial licenses. However the samples provided with the distribution of the SDK were designed to work in portrait orientation only. If you want to use the samples with landscape orientation, you’ll have to make some changes and some debugging if required.

    The buffer in NV21 format always comes the same no matter what the device orientations is (corresponds to the orientation of the camera sensor inside the device) but the orientation of the horizontal text relative to the sensor changes, so you’ll need to restart the service with changed orientation. After that the service should work correctly, but you’ll still have to modify the sample itself to show the result properly.

    We plan to improve our standard sample and add working with both orientations in the nearest future.

     

    1
  • Avatar
    Joni Mikkola

    Ok thanks for the updated reply. Now I know how to continue in case landscape is needed. So far it seems portrait has been enough for our demonstrating purposes.

    0

Please sign in to leave a comment.