Hi all,
I am using titanium to make a small app where i can click on a 'gallery' button on a window and it opens photogallery. On selecting the photo it should move to next window. But what it does is, it closes the photogallery first, after that i can see my first(button) screen and then it opens the next window.
I dont want it to show the previous window. Is there a way to do it??
I am adding windows to tabs . Below is my code .
cameraButton.addEventListener('click',function(e){ chooseImageFromGallery(); }); function chooseImageFromGallery(){ var capturedImg; //TODO Titanium.Media.showCamera({ Titanium.Media.openPhotoGallery({ success : function(event) { capturedImg = event.media; /* Condition to check the selected media */ if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) { var window1 = MyWindows.init(capturedImg, docImgModel, previous_win); MyCommon.addWindowToTabGroup(window1); win.close(); } }, cancel : function() { //While cancellation of the process activityInd.hide(); win.remove(activityInd); }, error : function(error) { /* called when there's an error */ var a = Titanium.UI.createAlertDialog({ titleid : 'camera' }); if (error.code == Titanium.Media.NO_CAMERA) { a.setMessage(L('camera_not_available')); } else { a.setMessage('Unexpected error: ' + error.message); } a.show(); activityInd.hide(); win.remove(activityInd); } }); }The init method just creates a new window and returns it .
The addWindowToTabGroup method adds it to the current tab<CODEBLOCK javascript> addWindowToTabGroup(window){
// tabGroup is a tab at global level declared in app.js
// activeTab returns the current tab
tabGroup.activeTab.open(window, {
animated : true
});
}
</CODEBLOCK>
Thanks a lot
Your Answer
Think you can help? Login to answer this question!