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

Android: iIlegalStateException Ambiguous Z index

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Release 2.1.0
    • Component/s: Android
    • Environment:

      Titanium SDK version: 2.1.0 (05/04/12 11:49 83be541)
      JS Engine: V8
      Platform & version: Android 2.3
      Device Details: Android Emulator
      Host Operating System: OS X 10.7.3
      Titanium Studio version: 2.0

      Description

      Problem Description

      On clicking a label in tableview row on Window1 ,Window2 should open.Window2 has a table and on selecting a row of this table, a label in Window1 is updated by firing an event. I am getting a force close when clicking a row on Window2 or clicking Back button .Attaching the sample for reference.

      Actual Results

      App Crashing with this log:

      [ERROR][TiApplication(  321)] (main) [88,88] Sending event: exception on thread: main msg:java.lang.IllegalStateException: Ambiguous Z-Order; Titanium 2.1.0,2012/04/25 10:00,4257074
      [ERROR][TiApplication(  321)] java.lang.IllegalStateException: Ambiguous Z-Order
      [ERROR][TiApplication(  321)] 	at org.appcelerator.titanium.view.TiCompositeLayout$1.compare(TiCompositeLayout.java:157)
      [ERROR][TiApplication(  321)] 	at org.appcelerator.titanium.view.TiCompositeLayout$1.compare(TiCompositeLayout.java:120)
      [ERROR][TiApplication(  321)] 	at java.util.TreeMap.cmp(TreeMap.java:1317)
      [ERROR][TiApplication(  321)] 	at java.util.TreeMap.put(TreeMap.java:1464)
      [ERROR][TiApplication(  321)] 	at java.util.TreeSet.add(TreeSet.java:111)
      [ERROR][TiApplication(  321)] 	at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:465)
      [ERROR][TiApplication(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][TiApplication(  321)] 	at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.onLayout(TiTableViewRowProxyItem.java:395)
      [ERROR][TiApplication(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][TiApplication(  321)] 	at android.widget.ListView.setupChild(ListView.java:1815)
      [ERROR][TiApplication(  321)] 	at android.widget.ListView.makeAndAddView(ListView.java:1730)
      [ERROR][TiApplication(  321)] 	at android.widget.ListView.fillSpecific(ListView.java:1272)
      [ERROR][TiApplication(  321)] 	at android.widget.ListView.layoutChildren(ListView.java:1558)
      [ERROR][TiApplication(  321)] 	at android.widget.AbsListView.onLayout(AbsListView.java:1147)
      [ERROR][TiApplication(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][TiApplication(  321)] 	at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
      [ERROR][TiApplication(  321)] 	at ti.modules.titanium.ui.widget.tableview.TiTableView.onLayout(TiTableView.java:516)
      [ERROR][TiApplication(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][TiApplication(  321)] 	at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:527)
      [ERROR][TiApplication(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][TiApplication(  321)] 	at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:527)
      [ERROR][TiApplication(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][TiApplication(  321)] 	at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
      [ERROR][TiApplication(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][TiApplication(  321)] 	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1249)
      [ERROR][TiApplication(  321)] 	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1125)
      [ERROR][TiApplication(  321)] 	at android.widget.LinearLayout.onLayout(LinearLayout.java:1042)
      [ERROR][TiApplication(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][TiApplication(  321)] 	at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
      [ERROR][TiApplication(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][TiApplication(  321)] 	at android.view.ViewRoot.performTraversals(ViewRoot.java:1045)
      [ERROR][TiApplication(  321)] 	at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
      [ERROR][TiApplication(  321)] 	at android.os.Handler.dispatchMessage(Handler.java:99)
      [ERROR][TiApplication(  321)] 	at android.os.Looper.loop(Looper.java:123)
      [ERROR][TiApplication(  321)] 	at android.app.ActivityThread.main(ActivityThread.java:4627)
      [ERROR][TiApplication(  321)] 	at java.lang.reflect.Method.invokeNative(Native Method)
      [ERROR][TiApplication(  321)] 	at java.lang.reflect.Method.invoke(Method.java:521)
      [ERROR][TiApplication(  321)] 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
      [ERROR][TiApplication(  321)] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
      [ERROR][TiApplication(  321)] 	at dalvik.system.NativeStart.main(Native Method)
      [ERROR][AndroidRuntime(  321)] FATAL EXCEPTION: main
      [ERROR][AndroidRuntime(  321)] java.lang.IllegalStateException: Ambiguous Z-Order
      [ERROR][AndroidRuntime(  321)] 	at org.appcelerator.titanium.view.TiCompositeLayout$1.compare(TiCompositeLayout.java:157)
      [ERROR][AndroidRuntime(  321)] 	at org.appcelerator.titanium.view.TiCompositeLayout$1.compare(TiCompositeLayout.java:120)
      [ERROR][AndroidRuntime(  321)] 	at java.util.TreeMap.cmp(TreeMap.java:1317)
      [ERROR][AndroidRuntime(  321)] 	at java.util.TreeMap.put(TreeMap.java:1464)
      [ERROR][AndroidRuntime(  321)] 	at java.util.TreeSet.add(TreeSet.java:111)
      [ERROR][AndroidRuntime(  321)] 	at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:465)
      [ERROR][AndroidRuntime(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][AndroidRuntime(  321)] 	at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.onLayout(TiTableViewRowProxyItem.java:395)
      [ERROR][AndroidRuntime(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][AndroidRuntime(  321)] 	at android.widget.ListView.setupChild(ListView.java:1815)
      [ERROR][AndroidRuntime(  321)] 	at android.widget.ListView.makeAndAddView(ListView.java:1730)
      [ERROR][AndroidRuntime(  321)] 	at android.widget.ListView.fillSpecific(ListView.java:1272)
      [ERROR][AndroidRuntime(  321)] 	at android.widget.ListView.layoutChildren(ListView.java:1558)
      [ERROR][AndroidRuntime(  321)] 	at android.widget.AbsListView.onLayout(AbsListView.java:1147)
      [ERROR][AndroidRuntime(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][AndroidRuntime(  321)] 	at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
      [ERROR][AndroidRuntime(  321)] 	at ti.modules.titanium.ui.widget.tableview.TiTableView.onLayout(TiTableView.java:516)
      [ERROR][AndroidRuntime(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][AndroidRuntime(  321)] 	at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:527)
      [ERROR][AndroidRuntime(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][AndroidRuntime(  321)] 	at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:527)
      [ERROR][AndroidRuntime(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][AndroidRuntime(  321)] 	at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
      [ERROR][AndroidRuntime(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][AndroidRuntime(  321)] 	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1249)
      [ERROR][AndroidRuntime(  321)] 	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1125)
      [ERROR][AndroidRuntime(  321)] 	at android.widget.LinearLayout.onLayout(LinearLayout.java:1042)
      [ERROR][AndroidRuntime(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][AndroidRuntime(  321)] 	at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
      [ERROR][AndroidRuntime(  321)] 	at android.view.View.layout(View.java:7035)
      [ERROR][AndroidRuntime(  321)] 	at android.view.ViewRoot.performTraversals(ViewRoot.java:1045)
      [ERROR][AndroidRuntime(  321)] 	at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
      [ERROR][AndroidRuntime(  321)] 	at android.os.Handler.dispatchMessage(Handler.java:99)
      [ERROR][AndroidRuntime(  321)] 	at android.os.Looper.loop(Looper.java:123)
      [ERROR][AndroidRuntime(  321)] 	at android.app.ActivityThread.main(ActivityThread.java:4627)
      [ERROR][AndroidRuntime(  321)] 	at java.lang.reflect.Method.invokeNative(Native Method)
      [ERROR][AndroidRuntime(  321)] 	at java.lang.reflect.Method.invoke(Method.java:521)
      [ERROR][AndroidRuntime(  321)] 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
      [ERROR][AndroidRuntime(  321)] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
      [ERROR][AndroidRuntime(  321)] 	at dalvik.system.NativeStart.main(Native Method)
      [WARN][ActivityManager(   60)]   Force finishing activity com.negoapps.zindexfailing/.ZindexfailingActivity
      [INFO][ARMAssembler(   60)] generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x36d630:0x36d6ec] in 5438000 ns
      [WARN][ActivityManager(   60)] Activity pause timeout for HistoryRecord{44ea2d00 com.negoapps.zindexfailing/.ZindexfailingActivity}
      [INFO][Process (  321)] Sending signal. PID: 321 SIG: 9
      [INFO][ActivityManager(   60)] Process com.negoapps.zindexfailing (pid 321) has died.
      [WARN][ActivityManager(   60)] Scheduling restart of crashed service com.negoapps.zindexfailing/org.appcelerator.titanium.analytics.TiAnalyticsService in 5000ms
      [INFO][WindowManager(   60)] WIN DEATH: Window{45141040 com.negoapps.zindexfailing/com.negoapps.zindexfailing.ZindexfailingActivity paused=false}
      [INFO][WindowManager(   60)] WIN DEATH: Window{450f34b0 com.negoapps.zindexfailing/org.appcelerator.titanium.TiModalActivity paused=false}
      [INFO][ActivityManager(   60)] Start proc com.negoapps.zindexfailing for service com.negoapps.zindexfailing/org.appcelerator.titanium.analytics.TiAnalyticsService: pid=335 uid=10044 gids={1015, 3003}
      [INFO][TiApplication(  335)] (main) [0,0] checkpoint, app created.
      

      Expected Results

      The app closing the window properly

      Test Case

      1. Create new mobile Project
      2. Paste this code

      // this sets the background color of the master UIView (when there are no windows/tab groups on it)
      Titanium.UI.setBackgroundColor('#000');
       
      var win2 = Titanium.UI.createWindow({
      	title : 'Tab 2',
      	backgroundColor : '#fff'
      });
       
       
       
      var label4 = Titanium.UI.createLabel({
      	color : '#999',
      	text : 'I am Date Picker in Win2',
      	font : {
      		fontSize : 20,
      		fontFamily : 'Helvetica Neue'
      	},
      	textAlign : 'center',
      	width : 'auto'
      });
      win2.add(label4);
       
      var ds=[];
      var ds1=[];
      var row1 = Ti.UI.createTableViewRow();
       
      row1.backgroundColor = 'yellow';
      var label2 = Titanium.UI.createLabel({
      	color : '#999',
      	text : 'I am Row2',
      	font : {
      		fontSize : 20,
      		fontFamily : 'Helvetica Neue'
      	},
      	textAlign : 'center',
      	width : 'auto'
      });
      var row2 = Ti.UI.createTableViewRow();
      row2.add(label2);
      ds1.push(row2);
      var table1 = Ti.UI.createTableView({data:ds1,height:100});
      row1.add(table1);
      ds.push(row1)
      var table = Ti.UI.createTableView({data:ds,height:200,top:20});
       
       
       
      win2.add(table);
      Ti.App.addEventListener('updatePeriod', function(param) {
      alert('fired')
      	label4.text = param.value;
      })
      label2.addEventListener('click', function(e) {
       
      	var win = createWindow();
      	win.open({
      		modal : true
      	});
      })
      win2.open();
       
      function createWindow() {
       
      	var win4 = Ti.UI.createWindow({
      		backgroundColor : 'black'
      	});
      	var ds3 = [];
      	var row1 = Ti.UI.createTableViewRow();
      	row1.selectedMenu='Annual'
      	var row2 = Ti.UI.createTableViewRow();
      	row2.selectedMenu='Semi'
      	var label1 = Titanium.UI.createLabel({
      		color : '#999',
      		text : 'Annual',
      		font : {
      			fontSize : 20,
      			fontFamily : 'Helvetica Neue'
      		},
      		textAlign : 'center',
      		width : 'auto'
      	});
      	var label2 = Titanium.UI.createLabel({
      		color : '#999',
      		text : 'Semi',
      		font : {
      			fontSize : 20,
      			fontFamily : 'Helvetica Neue'
      		},
      		textAlign : 'center',
      		width : 'auto'
      	});
      	row1.add(label1);
      	row2.add(label2);
      	ds3.push(row1);
      	ds3.push(row2);
      	var table2 = Ti.UI.createTableView({
      		top : 20,
      		data : ds3,
      		height : 150
      	})
       
      	table2.addEventListener('click', function(e) {
       
      		var index = e.index, section = e.section, row = e.row, rowdata = e.rowData, colorOff = '#363636', colorOn = '#385487';
      		/* Open Menu Windows */
       
      		setTimeout(function() {
       
      			for(var i = 0, len = section.rows.length; i < len; i++) {
      				section.rows[i].hasCheck = false;
      				section.rows[i].children[0].color = colorOff;
      			}
      			/* set current check */
      			section.rows[index].hasCheck = true;
      			e.row.children[0].color = colorOn;
      			if(e.rowData.selectedMenu === 'Annual') {
      				Ti.App.fireEvent('updatePeriod', {
      					value : 'Annual'
      				});
       
      			} else if(e.rowData.selectedMenu === 'Semi') {
      				Ti.App.fireEvent('updatePeriod', {
      					value : 'Semi'
      				});
      			}
       
      		}, 20);
      		win4.close();
       
      	});
       
      	win4.add(table2);
      	return win4;
      }
      

      3. Click on the label saying row 2
      4. Click again on the labels in the new window.

      HD Discussion

      http://support-admin.appcelerator.com/display/APP-536197

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ayeung Allen Yeung
                Reporter:
                mpmiranda Mauro Parra-Miranda
              • Watchers:
                1 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:

                  Git Source Code