Problem description
When a user selects an image and he shares this with the app, the correct window opens and the app is fully functional. But when the app is closed, it seems to reboot and hangs in the startup screen.
Steps to reproduce
1. Edit tiapp.xml adding the following sections:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>8</tool-api-level>
<manifest android:installLocation="preferExternal" android:versionCode="12" android:versionName="1.2.2">
<uses-sdk android:minSdkVersion="8"/>
<supports-screens android:anyDensity="false"/>
<application>
<activity android:alwaysRetainTaskState="true" android:configChanges="keyboardHidden|orientation" android:label="DBAPP" android:name=".DBAPPActivity" android:theme="@style/Theme.Titanium">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
</application>
</manifest>
</android>
<property name="ti.android.bug2373.disableDetection" type="bool">false</property>
<property name="ti.android.bug2373.restartDelay" type="int">500</property>
<property name="ti.android.bug2373.finishDelay" type="int">0</property>
<property name="ti.android.bug2373.skipAlert" type="bool">true</property>
<property name="ti.android.threadstacksize" type="int">32768</property>
<property name="ti.android.bug2373.message">De applicatie dient na installatie opnieuw opgestart te worden</property>
<property name="ti.android.bug2373.title">Succesvol geinstalleerd</property>
<property name="ti.android.bug2373.buttonText">Ga verder</property>
<property name="ti.android.runtime">v8</property>
<property name="ti.android.fastdev" type="bool">false</property>
<property name="ti.android.root.reappears.restart" type="bool">false</property>
2. Create an app.js with the following code:
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
var hasIntent = false;
var intentData = null;
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
var intent = Ti.Android.currentActivity.getIntent();
var iname = Ti.Android.EXTRA_STREAM;
if (intent && intent.hasExtra(iname)) {
hasIntent = true;
intentData = intent.getBlobExtra(iname);
Ti.API.info(intent);
}
//
// create base UI tab and root window
//
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'
});
if(hasIntent)
{
label1.text = 'We have an intent.. do something!';
}
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();
3. Run the app once
4. Close the app, open the gallery
5. Share one picture with the app
6. The app opens correctly: close it
Current result
The app seems to reload and crash.
The problem seems to be present only with the TabGroups enabled. The following code works well:
@Davide - We need complete environment information to diagnose this issue.
Tried with SDK 3.2.1, works without any crash.
Closing ticket as the issue cannot be reproduced.