Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-1911

Android: Titanium apps can't survive an activity relaunch

    Details

      Description

      {html}<div><p>Because of the cleanup code in TiUIWindow (see
      <code>release()</code>), Titanium apps can't survive an activity
      relaunch. Even the simplest app:</p>
      <pre>
      <code class="javascript">/*global Ti, Titanium, alert, JSON */
      Titanium.UI.setBackgroundColor('#000');
      Titanium.UI.createWindow({ title:'Test', backgroundColor:'#fff', fullscreen: true, exitOnClose: true }).open();</code>
      </pre>
      <p>To cause an activity relaunch, change the locale while the
      activity is running. Example:</p>
      <ul>
      <li>
      <p>Open a titanium app.</p>
      </li>
      <li>
      <p>Keeping it open (i.e., don't back out), hit your Home key.</p>
      </li>
      <li>
      <p>Go to Settings -> Language & Keyboard -> Select
      language, then change the language.</p>
      </li>
      <li>
      <p>Go back to the Titanium app – it will crash.</p>
      </li>
      </ul>
      <p>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
      <code>onDestroy</code>, which in our code results in the window
      cleaning up itself, but then activity create occurs again. Now the
      <code>handler</code> object is null, however, and all views are
      gone.</p>
      <p>Is there some way for us to determine if <code>onDestroy</code>
      is occurring because of a relaunch?</p></div>{html}

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                billdawson Bill Dawson
                Reporter:
                billdawson Bill Dawson
              • Watchers:
                12 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Source Code