Sorry for technical details, the question is below.
Many posts tagged android-camera spread a wrong pattern: quite a few upvoted or accepted answers recommend to use Camera.open(CameraInfo.CAMERA_FACING_FRONT)
instead of enumerating cameras with for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); camIdx++)
and checking cameraInfo.facing
for each of the cameras.
I understand that the blame is to the large extent on Google. They added the feature to camera API too late, they did not provide a code snippet, the correct code is ridiculously long, and they used confusing integer constants that too strongly resemble the correct indexes. But this is not an excuse for spreading incorrect information.
The question is how to clean up this mess. Should these answers be flagged, or edited, or there should be a comment for each of them, linking to the correct solution? It's a lot of work, and if each such change needs also community verification, and author's consent, it will simply never be done. The infection will spread at a higher rate than the old ones will be fixed
Note that not all questions revealed by the easy search above are duplicates; some, but not all wrong answers are copy/paste; sometimes, these questions and answers touch other topics, sometimes even the answers and simply deleting the answers may be wrong.