RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.81k stars 405 forks source link

How to Open camera again immediately after capturing the image ? #337

Open YogeshLegendkiller opened 5 years ago

YogeshLegendkiller commented 5 years ago

Hello folks, Thanks for the fantastic library how to reopen camera after image taken i have searched and tried a lot but i couldn't do this now let me post what i have tried so far:

    fotoapparat.takePicture().toBitmap().transform(new Function1<BitmapPhoto, Bitmap>() {
             @Override
             public Bitmap invoke(BitmapPhoto bitmapPhoto) {
                 Log.e("my pick transform", bitmapPhoto.toString());
                 return Utility.rotate(bitmapPhoto.bitmap, -bitmapPhoto.rotationDegrees);
             }
         }).whenAvailable(new Function1<Bitmap, Unit>() {
             @Override
             public Unit invoke(Bitmap bitmap) {

                 if (bitmap != null) {
                     Log.e("my pick", bitmap.toString());
                     synchronized (bitmap) {
                           fotoapparat.start();     <-  Here am starting the camera again but camera is not open again
                     }
                 }
                 return null;
             }
         });

How to open again once image is taken ? thanks in advance

Diolor commented 5 years ago

Why need to start the camera again? The api is meant to :

What extra behavior do you need?