I've been fighting for a while with https://github.com/commonsguy/cwac-camera
Managed to create my custom CameraFragment
and a custom custom CameraHost
.
I've overrode getPictureSize
and getPreviewSize
. With those two methods I'm able to find out which Size
s are able to be used. My overall idea is to capture a square image, and also preview it before capturing.
I've been testing and no device is returning a square-formatted Size
, so I guess the best approach would be taking the Size nearest to my needs. Like if I need an 800x800 squared image, I will return the nearest Size
, that would be (for example) 1280x1024
So far so good. The issue is the following:
Documentation states:
Usually, your CameraHost will be called with getPreviewSize()
Damn; my Nexus5 device never triggers this method, but a Genymotion emulator does. So in my emulator I can create a custom preview size, which I can't with my real device. So I need some help with this issue. Why is it just "usually"? What can I do to change it to "always"?
On a second term, I need some tips: If I want an squared preview size, which I know it won't be available by default Size
s returned by getSupportedPreviewSizes
, what can I do to display an square? Maybe overlaying a square on top of CameraFragment
? Is it even possible? Or should I go for any other approach?
Anyways, congratulations on the library; it's absolutely clear and with so many options. No need to worry about "some devices". That's great as an Android Developer.
Thank you.