Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3151] A new thread is created for each launch of the application, even it is in background (1 tap on Icon = 1 new activity)

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNeeds more info
Resolution Date2011-08-31T19:24:03.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid, launch
ReporterPatric de Waha
AssigneeTony Guntharp
Created2011-06-23T10:50:54.000+0000
Updated2016-03-08T07:48:13.000+0000

Description

The following usecase reproduces the issue:
Titanium.UI.setBackgroundColor('#000');

var tabGroup = Titanium.UI.createTabGroup();

var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({  
    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);

var win2 = Titanium.UI.createWindow({  
    title:'Tab 2',
    backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({  
    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);

tabGroup.addTab(tab1);  
tabGroup.addTab(tab2);  

tabGroup.open();
First time taping on the application Icon: the application starts like it should. Then, when taping the icon from dashboard or from application list: A new thread (activity) is started within the already existing application process, each time! The taskscreen is not affected by this: it brings the app to foreground like expect The expected behavior is: Bringing application to foreground, instead of running new activities. Changes were "debuggable=true" in AndroidManifest.xml, so I can track the thread activity, fastdev has also been disabled. I set launchmode:singleTop manually in AndroidManifest, but didn't help. Picture of DDM with multiple threads has been included, along with DDM log output. This bug is critical, each time new threads are created the memory consumption increases which finally leads to application crash.

Attachments

FileDateSize
bugtest2.zip2011-06-23T10:50:54.000+00005235052

Comments

  1. Paul Dowsett 2011-08-04

    Thanks for raising this ticket. When writing code to reproduce the issue, try to keep it as simple as possible; there is no need for comments or tab icons, for instance. See [Creating Good Use-cases](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-CreatingGoodUsecases) for more information about this. You should ideally add your code in a wiki markup code block, rather than attaching it, as it makes the code more accessible. This is the same for log files, unless they are very long. I have made these changes. Please take a look, for the next ticket that you raise. See the [Jira Ticket Checklist](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-Summary%3AJiraTicketChecklist) for the official guidelines. Would you please check the ticket for correctness, as it stands? Could you edit the ticket and clarify which versions of Android you have tested (you have mentioned both 2.1.1 and 2.3.3, but it is not clear what the outcome was in each case). Once you have provided this info, I can move the ticket to the respective project. Thanks
  2. Paul Dowsett 2011-08-31

    Patric You are welcome to reopen this ticket if you are prepared to verify that it is still correct since my changes, and then I will move it to the main project. Thanks
  3. Paul Dowsett 2011-10-07

    Closing due to inactivity.

JSON Source