Let's just separate out the bit that creates the duplicate images.
This works for me.
//Called when application is started.
function OnStart()
{
app.SetOrientation( "Landscape" );
//Create horizontal layout that fills the screen.
lay = app.CreateLayout( "Linear", "Horizontal,FillXY,VCenter" );
lay.SetBackground( "/res/drawable/pattern_carbon", "repeat" );
//Create camera view control.
cam = app.CreateCameraView( 0.6, 0.8 );
cam.SetOnReady( OnReady );
cam.SetMargins( 0, 0, 0.04, 0 );
lay.AddChild( cam );
//Add main layout to app.
app.AddLayout( lay );
}
function OnReady()
{
var w = cam.GetImageWidth();
var h = cam.GetImageHeight();
//Create vertical layout on right for other stuff.
layRight = app.CreateLayout( "Linear", "Vertical" );
lay.AddChild( layRight );
//Create image control for previewing pictures.
img = app.CreateImage( null, 0.18, 0.22,"fix",w,h );
img.SetBackColor( "#ff000000" );
layRight.AddChild( img );
img.SetMargins( 0,0,0,0.05 );
img2 = app.CreateImage( null, 0.18, 0.22,"fix",w,h );
img2.SetBackColor( "#ff000000" );
layRight.AddChild( img2 );
cam.SetDuplicateImage( img,img2 );
cam.StartPreview();
}
Thanks works now :)