[AC-1439] Tabgroup on android causes black screen on resume
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2014-04-06T06:03:44.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | 3.2.1, android |
Reporter | Bill Martensson |
Assignee | Ritu Agrawal |
Created | 2014-03-26T14:08:38.000+0000 |
Updated | 2016-03-08T07:37:52.000+0000 |
Description
This have been tested on titanium 3.1, 3.2, 3.2.1, 3.2.2 and android 4.1,4.3
I create a new project with the following app.js
var win1 = Titanium.UI.createWindow({
title:'Test',
backgroundColor:'#00ff00'
});
win1.open();
I then press the home button to pause the app. Then open several other apps to trigger a kill of the app.
When I resume the app there is just a black screen.
I then add this part in tiApp.xml:
<activity android:alwaysRetainTaskState="true"
When I do the same as above and resume the app, the app closes and relaunches. Which is correct behavior from what I've read.
If I change the app.js to include a tabgroup:
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
var label1 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 1',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
win1.add(label1);
//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 2',
window:win2
});
var label2 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 2',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
win2.add(label2);
//
// add tabs
//
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
// open tab group
tabGroup.open();
This reintroduces the problem with the black screen on resume after kill signal.
alwaysRetainTaskState is only useful on the root Activity of the application and that explains why it works for your first code snippet (root activity) and not with the tab group as that is not the root activity. This attribute is ignored for all other activities. http://developer.android.com/guide/topics/manifest/activity-element.html http://stackoverflow.com/questions/4634985/how-to-test-androidalwaysretaintaskstate