var mygmail = app.GetUser(); var txt, yesNo, archname; //Called when application is started. function OnStart() {     //Create a layout with objects vertically centered.     var lay = app.CreateLayout( "linear", "FillXY" );         //Create a text label and add it to layout.     txt = app.CreateText( "..." );     lay.AddChild( txt );     //Add layout to app.         app.AddLayout( lay );     var fname = CreateArchive();     yesNo = app.CreateYesNoDialog( "Send by mail?" );      yesNo.fname = fname;     yesNo.SetOnTouch( yesNoMail_OnTouch ); } //Create a backup archive. function CreateArchive( ) {     var archfolder = "/sdcard/sjgapps/archive/";      app.MakeFolder(archfolder);     //Create project zip file.     var zip = app.CreateZipUtil();     var fldr = "/sdcard/DroidScript";     archname = (new Date).toISOString().slice(0,19 );     archname = "ds"+archname.replace(/[-:]/g,"");     archname =  archname.replace(/T/,"_");     archname += ".zip";     var file = archfolder+archname;     archname = app.GetModel()+"/"+archname;     zip.Create( file );     app.ShowProgress( "Archiving..." );     AddFolder( zip, "DroidScript", fldr );     app.HideProgress();     zip.Close();     return file; } //Recursively add folder contents to zip. function AddFolder( zip, name, fldr ) {     txt.SetText(name);     var list = app.ListFolder( fldr,"",0,"alphasort" );     for( var i=0; i