Hello appcelerator experts,
I'm currently programming a simple app with 3 windows (in an alloy). The windows show up after each other when pressing a button, so window 1 is displayed with a button -> go to window 2 -> press its button -> window 3. With the back button you can return to previous windows.
The problem is that the app sometimes crashes and restarts when switching between windows and produces the error "ViewRootImpl #2 Surface is not valid", which I have no clue how to solve. Anyone who has seen this problem before or has a guess what might be the problem? Maybe something with eventListeners getting deleted too often?
Application type: mobile Titanium SDK: 3.4.0.GA Platform & version: Android 4.1 Device: physical android devices Host Operating System: Mac OSX Yosemite Titanium studio: 3.4.0.201409261227 build: jenkins-titanium-rcp-master-197
View (index.xml):
<Alloy>
<Window id="intro_android" class="container">
<View id="vdescription">
<Label id="description1">Do you like discovering new restaurants, eating nice food AND saving money?</Label>
<Label id="description2">The Food Fairy will help you!</Label>
<Label id="description3">You will receive notifications like this:</Label>
<ImageView id="screenshot" image="/images/screenshot.png"></ImageView>
</View>
<View class="vbutton">
<Button id="getstarted" ></Button>
</View>
</Window>
<Window id="usage_android" class="container">
<View id="vsaved">
<Label id="text_saved">You currently saved:</Label>
<Label id="amount_saved">00.00 €</Label>
</View>
<View id="vranking">
<TableView id="table">
<TableViewSection>
<TableViewRow class="row1"><Label class="number_ranking">1.</Label><Label class="name_ranking">John</Label><Label class="amount_ranking">637.02 €</Label></TableViewRow>
<TableViewRow class="row2"><Label class="dots_ranking">...</Label></TableViewRow>
<TableViewRow class="row3"><Label class="number_ranking">524.</Label><Label class="name_ranking">Mary</Label><Label class="amount_ranking">00.81 €</Label></TableViewRow>
<TableViewRow class="userrow_ranking"><Label id="usernumber_ranking">525.</Label><Label id="username_ranking">YOU</Label><Label id="useramount_ranking">00.00 €</Label></TableViewRow>
<TableViewRow class="row4"><Label class="number_ranking">526.</Label><Label class="name_ranking">Sarah</Label><Label class="amount_ranking">00.00 €</Label></TableViewRow>
<TableViewRow class="row5"><Label class="dots_ranking">...</Label></TableViewRow>
</TableViewSection>
</TableView>
</View>
<View class="vbutton">
<Button id="gethelp" ></Button>
</View>
</Window>
<Window id="help" class="container">
<ScrollView id="vhelp">
<Label id="help_text1">Heres more information:</Label>
<Label class="help_text2">The Food Fairy finds the best food deals close to you! To help you find a place close-by to grab a bite on a budget, the fairy will send you a notification when you approach a restaurant offering a special deal.</Label>
<Label class="help_text2">Because shes magic (duh), she doest need your app to be open and doesnt use GPS; she will know where you are, where the deals are, and will let you know when your paths cross.</Label>
</ScrollView>
</Window>
</Alloy>
Controller (index.js):
function start_android(e) {
$.usage_android.open();
}
function start_ios(e) {
$.usage_ios.open();
}
function start_help(e) {
$.help.open();
}
Thanks for any help!