Q: getCameraIdList() function returns an empty array I'm trying to work with Android's camera API 2, and I had a bug which I wasn't able to fix.
The function getCameraIdList() returns an empty array for some reason, although I do have 2 working cameras on my emulator (I checked it using the Android camera app).
I am working on an emulated device with the following details:
Device: Nexus S
API level: androd 4.4.2, API level 19
CPU: intel atom x86
front & back camera are emulated
what do you think?
attached is the code.
private CameraManager mManager;
private String[] mCameraIds;
mManager = (CameraManager)getSystemService(Context.CAMERA_SERVICE);
mCameraIds = mManager.getCameraIdList();


A: The function getCameraIdList works only from version 21 of Android API

A: Here are four things that might get the app to start working again. One of these four have always done the trick for me when the I get the error.


*

*Switch to another app and then back to the camera app.
Hit the back button to exit the camera app and then tap to open it again. This has the least success rate, to be honest, but it does work and it's the quickest solution.  

*Exit all apps that might be using the camera. 
 Go to Settings>Battery and check if mm-qcamera-daemon  is running. Exit it and launch the app again to see if the camera connects. 

*Exit the app and relaunch it. This works most times. 
  If it doesn't try to force stop the app and clear the cache. The measures sound drastic but it has a high success rate.

*If all else fails, restart your phone.
 Exit every app that's running before restart it. I found this to work when nothing else would and so far the error hasn't popped up again.

