Building Mobile Enterprise Applications : Using webMethods Mobile Designer : Coding a Mobile Application : Mobile Designer-Provided Run-Time Classes : Migration to the New Run-Time based on the _NativeUIDemo_ example : Using CameraHandler in New-Runtime
Using CameraHandler in New-Runtime
Since all Mobile Designer callbacks happen in the UI thread, CameraHandler should be used in a different way to avoid a deadlock.
1. Initialize the camera by calling CameraHandler.getInstance().initCamera(null);.
2. Use the async method with callback to get a snapshot from the camera.
3. Remove the old code:
CameraHandler.getInstance().initCamera(null);
transitionToView(
onCreateSnapshotView(
CameraHandler.getInstance().getCameraSnapshot(null,
(nUIController.getScreenWidth() * 3) >> 2,
(nUIController.getScreenHeight() * 3) >> 2)),
mainpane);
4. Insert the new code:
CameraHandler.getInstance().initCamera(null);
CameraHandler.getInstance().getCameraSnapshotAsync( null,
(nUIController.getScreenWidth() * 3) >> 2,
(nUIController.getScreenHeight() * 3) >> 2,
new ICameraHandlerCallback() {
public void onSnapshotTaken(Image snapshot)
{
transitionToView (onCreateSnapshotView(snapshot), mainpane);
}
});
Copyright © 2007-2017 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback