Aaaaaargh! onPreviewFrame is not called on Android ICS

When using the Camera preview on android, there is a setPreviewCallback method to get the preview frames. (The API doc says it will do that.)

However, I never saw the callback is being called.

try {
	callbackBuffer = new byte[mCamera.getParameters().getPreviewSize().width * mCamera.getParameters().getPreviewSize().height * (ImageFormat.getBitsPerPixel(mCamera.getParameters().getPreviewFormat()) / 8)];
    mCamera.addCallbackBuffer(callbackBuffer);
    mCamera.setPreviewCallbackWithBuffer(this);
    mCamera.setPreviewDisplay(holder);
    mCamera.startPreview();
} catch (IOException e) {
    Log.d(TAG, "Error setting camera preview: " + e.getMessage());
}

Not works.

try {
    mCamera.setPreview(@Override
	public void onPreviewFrame(byte[] data, Camera camera) {
		Log.i(TAG, "preview");
	}
    });
    mCamera.setPreviewDisplay(holder);
    mCamera.startPreview();
} catch (IOException e) {
    Log.d(TAG, "Error setting camera preview: " + e.getMessage());
}

Nope.

I could find a bug report about it.
onPreviewFrame never called when using setPreviewCallback

It seems like a bug on Android ICS, but it’s not clear which version is fixed. My device is 4.1.2 and just not working, and there will be so many people with ICS, because the Android device manufacturers doesn’t provide the OS update for the customers.
And android OS developers are not providing any explanation or the workaround to avoid it.

Developing on Android is just a mess..

Using Intel HAXM Android x86 emulator on OSX Mavericks 10.9

After the OSX Mavericks 10.9 update, Android x86 emulator will crash or freeze on start.

I updated all the SDKs on the Android SDK Manager, but it didn’t help. After some googling, it turns out I wasn’t the only person with such defect.

Intel released the HAXM hotfix for OSX 10.9 and Windows 8.1.
Info
Download page

After installing the hotfix, still my virtual devices didn’t work.
(Also be aware that you couldn’t use VirtualBox 4.2.14 simultaneously with the emulator.)

After some testing, Android 4.x emulator works well without a problem, but only the Android 2.3.3 emulator still crashes on start.

I was using the emulators with the ‘Use Host GPU’ option(because it is recommended), but disabling that option makes the Android 2.3.3 x86 emulator work.

I’m not sure whether it’s a applicable solution for all, but if you have the same problem, give it a try.