I'm using the CameraDemo app included with cwac-camera. I'm trying to make the zoom bar change from the main activity using a method updateZoom() but I'm getting a nullpointerexception sometimes from the zoomTo return. Most of the time the zoom will work but then occasionally the program will crash.
Updated zoom:
public void updateZoom()
{
zoom.setEnabled(false);
current.zoomTo(zoom.getProgress()).onComplete(new Runnable() {
@Override
public void run() {
zoom.setEnabled(true);
}
}).go();
}
Call to updateZoom():
zoom.incrementProgressBy(20);
updateZoom();
Error Logs:
03-01 09:47:55.763: E/AndroidRuntime(31950): FATAL EXCEPTION: main
03-01 09:47:55.763: E/AndroidRuntime(31950): Process: com.commonsware.cwac.camera.demo, PID: 31950
03-01 09:47:55.763: E/AndroidRuntime(31950): java.lang.NullPointerException
03-01 09:47:55.763: E/AndroidRuntime(31950): at com.commonsware.cwac.camera.CameraFragment.zoomTo(CameraFragment.java:269)
03-01 09:47:55.763: E/AndroidRuntime(31950): at com.commonsware.cwac.camera.demo.MainActivity.updateZoom(MainActivity.java:163)
03-01 09:47:55.763: E/AndroidRuntime(31950): at com.commonsware.cwac.camera.demo.MainActivity$1.onPose(MainActivity.java:116)