[TIMOB-1911] Android: Titanium apps can't survive an activity relaunch
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-02-10T19:50:29.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Sprint 2012-03, Release 2.0.0, Release 1.8.2 |
Components | Android |
Labels | android, feature |
Reporter | Bill Dawson |
Assignee | Bill Dawson |
Created | 2011-04-15T03:05:22.000+0000 |
Updated | 2017-03-24T21:01:49.000+0000 |
Description
Because of the cleanup code in TiUIWindow (see
release()
), Titanium apps can't survive an activity
relaunch. Even the simplest app:
/*global Ti, Titanium, alert, JSON */
Titanium.UI.setBackgroundColor('#000');
Titanium.UI.createWindow({
title:'Test',
backgroundColor:'#fff',
fullscreen: true,
exitOnClose: true
}).open();
To cause an activity relaunch, change the locale while the activity is running. Example:
-
Open a titanium app.
-
Keeping it open (i.e., don't back out), hit your Home key.
-
Go to Settings -> Language & Keyboard -> Select language, then change the language.
-
Go back to the Titanium app -- it will crash.
What's happening can be shown in the attached
relaunch_activity.png graphic. Apparently Android forces the
activity to relaunch if the locale has changed. This causes
onDestroy
, which in our code results in the window
cleaning up itself, but then activity create occurs again. Now the
handler
object is null, however, and all views are
gone.
Is there some way for us to determine if onDestroy
is occurring because of a relaunch?
Attachments
File | Date | Size |
---|---|---|
relaunch_activity.png | 2011-04-15T03:05:23.000+0000 | 172489 |
SendLog (2).txt | 2012-02-08T15:27:36.000+0000 | 152840 |