1

I try use cwac-cam2 library to take picture

Sample code:

Intent i = new CameraActivity.IntentBuilder(this)
                    .to(new File(getFilesDir(), "picture.jpg"))
                    .updateMediaStore()
                    .build();

Tested on :

  1. Androin one marshmallow mito a10
  2. Activity is extended from AppCompatActivity
  3. Theme.AppCompat.Light

After click camera to take picture get error like below :

java.lang.IllegalStateException: CameraActivity confirmation requires an action bar!
11-10 21:31:54.526 11278-11278/com.plugie.towing E/AndroidRuntime:     at com.commonsware.cwac.cam2.ConfirmationFragment.onHiddenChanged(ConfirmationFragment.java:84)
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
Plugie
  • 1,289
  • 17
  • 25

1 Answers1

4

After read cameraActivity document I fix the error by adding the theme configuration for and CameraActivity in AndroidManifest.xml :

<activity android:name="com.commonsware.cwac.cam2.CameraActivity"
            android:theme="@android:style/Theme.Holo.Light"/>
Plugie
  • 1,289
  • 17
  • 25