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

Android: SDK 3.1.2 heavyweight/lightweight window confusion

    Details

      Description

      Apparently with SDK 3.1.2.GA, Titanium thinks a lightweight window has an associated activity and action bar. In SDK 3.1.1.GA, window.getActivity() returns null for lightweight windows, but not in 3.1.2.GA

      index.xml:

      <Alloy>
      	<!-- if we add navBarHidden="false" to Window element it becomes heavyweight,
      	but if we leave it out 3.1.2 *thinks* it's heavyweight, and crashes. 3.1.1 treats it as lightweight
      	-->
      	<Window class="container" id="win1">
      		<Label id="label1">Just a label</Label>
      	</Window>
      </Alloy>
      

      index.js:

      function homeIconClicked() {
      	alert('clicked');
      }
       
      $.win1.addEventListener('open', function() {
      	if (OS_ANDROID) {
      		var activity = $.win1.getActivity();
      		if (!activity){
      			alert('no activity for this window');
      			return;
      		}
      		var actionBar = activity.actionBar;
      		if (actionBar){
      			actionBar.title = 'Window 1';
      			actionBar.displayHomeAsUp = true;
      			actionBar.onHomeIconItemSelected = homeIconClicked;
      		} else {
      			alert('no action bar');
      		}
      	}	
      });
      $.win1.open();
      

      snippet from tiapp.xml:

      <android xmlns:android="http://schemas.android.com/apk/res/android">
          <tool-api-level>17</tool-api-level>
          <manifest android:installLocation="preferExternal">
              <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16"/>
          </manifest>
      </android>
      

        Attachments

          Activity

            People

            • Assignee:
              pwang Ping Wang
              Reporter:
              mokesmokes Mark Mokryn
              Reviewer:
              Hieu Pham
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-17235
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration