Durga Prasad
unread,Jan 6, 2015, 11:39:25 AM1/6/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to androi...@googlegroups.com
Hi Tim,
Thanks for the reply. This is what i tried. But seems to be not working...
//Called when application is started.
function OnStart()
{
//Fix orientation to landscape since
//most phone's cameras work this way.
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.SetMargins( 0, 0, 0.04, 0 );
lay.AddChild( cam );
//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 );
img.SetBackColor( "#ff000000" );
layRight.AddChild( img );
//Set target image for picture previews.
cam.SetPreviewImage( img );
//Create shutter button.
btn = app.CreateButton( "Snap", 0.2, 0.15, "Alum" );
btn.SetMargins( 0, 0.06, 0, 0 );
btn.SetOnTouch( btn_OnTouch );
layRight.AddChild( btn );
//Add main layout to app.
app.AddLayout( lay );
//Create a folder for snaps.
snapFolder = "/sdcard/Snaps";
app.MakeFolder( snapFolder );
//Start preview after 1 second.
cam.SetFlash("on");
setTimeout( "cam.StartPreview()", 1000);
}
//Handle shutter button.
function btn_OnTouch()
{
//Take a picture and store to sdcard.
//cam.Setflash("on");
cam.TakePicture( snapFolder + "/Snap.jpg" );
cam.SetFlash("off");
}