I'm sure most of you used an Android phone before and took a picture. Whenever the user changes the position of the mobile phone and holds it still, the camera focuses automatically. It is hard for me to replicate this in my application. The autofocus method () is called only once when the application starts. I have been looking for a solution in the last 3 days, and while reading the Google documentation, I came across calls to the sensor method (for example, when the user tilts the mobile phone forward or backward). I could use this API to achieve what I need, but it sounds too dirty and too complicated. I am sure there is another way.
All the examples on the Internet that I found focus only when the user clicks on the screen or button. I also looked at a few questions about SO to hope to find what I am looking for, but I have not been successful. I saw this question and that String is not compatible with my phone. For some reason, only the focus modes that I can use are fixed and automatic.
I was hoping that someone here would shed light on this subject, because I am at a loss.
Thanks so much for your time.
source
share