Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

[Alloy] How to open a Window from another and totally remove from memory the first one avoiding possible memoey issues

$
0
0
  • Application type: Alloy mobile for Android
  • Titanium SDK: 3.5.0.GA
  • Platform & version: Android
  • Device: real S3 Andr. 4.3 and Genymotion API 10
  • Host Operating System: Win x64
  • Titanium Studio: Titanium Studio, build: 3.4.1.201410281727

HI Folks, I'm doing some experiments about an Android app in Alloy structured in some different Windows. Now, could anyone tell me, please, how to open a Window contained in a VIEW file called 'win02.xml' from a Window contained in a VIEW file called index.xml?

I wrote in the CONTROLLER file index.js this

function openWin02(){
    var newWin = Alloy.createController('win02').getView();
    newWin.open();
    $.index.close(); // this causes alway an error so I've to delete it
    $.destroy();    
};
 
....
 
btn.addEventListener('click', openWin02);
but, when I click on 'btn' I got this error: "Sorry! This application... has stopped unexpectedly. Please try again. The error is causes by this:

$.index.close();

in the index.js controller file. If I remove it I can open di new window.


  • Where am I making mistakes?
  • Why I cannot close the window (in classic mode I didn't get this error).
  • Is $.destroy(); enogh for removing everything about index Window (views, buttons, labels, event listeners and so on)

My goal is to open a different Window form another and remove everything about it from memory avoiding possible leak issues. Thanks


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>