Titanium.UI.setBackgroundColor('#000'); //creating the window var win1 = Titanium.UI.createWindow({ title:'win 1', backgroundColor:'#fff' }); //add window - navigation bar var modalWin = Ti.UI.createWindow(); //nav bar var navmodal = Ti.UI.iPhone.createNavigationGroup({ window:modalWin }); win1.add(navmodal); //button for the nav bar var b2t = Titanium.UI.createButton({ title:'Launch' }); modalWin.RightNavButton = b2t; //button for the window var b1t = Titanium.UI.createButton({ title:'Launch', height:40, width:200, top:270 }); win1.add(b1t); //Setting up the documentviewer z = Ti.UI.iPad.createDocumentViewer({url:'Example.pdf'}); //documentviewer with animation set on and a quicklook view poping up next to a view b1t.addEventListener('click', function() { z.show({animated:false,view:b2t}); }); //documentviewer with animation set off b2t.addEventListener('click', function() { z.show(); }); win1.open(); var interval = setInterval(function() { z.hide(); Ti.API.info('z has been closed'); clearInterval(interval); }, 5000);