Titanium Mobile
  1. Titanium Mobile
  2. TIMOB-11502

Android: TableView - Application crashes when adding a TableViewSection with headerView

    Details

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

      Description

      Problem

      I have a fairly simple TableView in my app which crashes only when compiled with SDK 2.1.3. Inside the DDMS log attached you can find the exception thrown. The cause of the crash seems to be the headerView of the TableViewSection. Using the following test case the app crashes in the Android Emulators 4.0.3 and 4.1 on both WVGA800 and WXGA720 screen, but inside my app this code crashes only when ran on the WXGA720 screen.

      Test case

      var self = Ti.UI.createWindow({
      		backgroundColor: "#ffffff",
      		tabBarHidden: true
      	});
      
      var tableViewData = [];
      	
      var tableView = Ti.UI.createTableView({
      	style:Titanium.UI.iPhone.TableViewStyle.GROUPED,
      });
      
      self.add(tableView);
      
      var headerView = Ti.UI.createView({
      	height: 90,
      	borderColor: 'transparent',
      	borderWidth: 0,
      });
      
      var headerImageContainer = Ti.UI.createView({
      	left: 19,
      	height: 64,
      	width: 64
      });
      	
      headerImageContainer.add(Ti.UI.createView({
      	backgroundImage: '/images/person.png',
      	width: 64,
      	height: 64,
      	borderColor: '#a9a9a9',
      	borderRadius: 4,
      	borderWidth: 1,
      	
      }));
      
      headerView.add(headerImageContainer);
      
      tableViewData.push(Ti.UI.createTableViewSection({
      	headerView: headerView,
      }));
      
      tableView.data = tableViewData;
      
      self.add(tableView);
      
      self.open();
      

        Activity

        Hide
        Karl Rowley added a comment -

        When these two lines of Javascript code are removed, there is no failure:

        borderColor: 'transparent',
        borderWidth: 0,

        This is the first place I see a problem:

        Thread [<1> main] (Suspended (exception IllegalStateException))
        <VM does not provide monitor information>
        ListView.layoutChildren() line: 1662
        ListView(AbsListView).onLayout(boolean, int, int, int, int) line: 1147
        ListView(View).layout(int, int, int, int) line: 7035
        TiTableView(FrameLayout).onLayout(boolean, int, int, int, int) line: 333
        TiTableView.onLayout(boolean, int, int, int, int) line: 555
        TiTableView(View).layout(int, int, int, int) line: 7035
        TiCompositeLayout.onLayout(boolean, int, int, int, int) line: 583
        TiCompositeLayout(View).layout(int, int, int, int) line: 7035
        TiCompositeLayout.onLayout(boolean, int, int, int, int) line: 583
        TiCompositeLayout(View).layout(int, int, int, int) line: 7035
        FrameLayout.onLayout(boolean, int, int, int, int) line: 333
        FrameLayout(View).layout(int, int, int, int) line: 7035
        LinearLayout.setChildFrame(View, int, int, int, int) line: 1249
        LinearLayout.layoutVertical() line: 1125
        LinearLayout.onLayout(boolean, int, int, int, int) line: 1042
        LinearLayout(View).layout(int, int, int, int) line: 7035
        PhoneWindow$DecorView(FrameLayout).onLayout(boolean, int, int, int, int) line: 333
        PhoneWindow$DecorView(View).layout(int, int, int, int) line: 7035
        ViewRoot.performTraversals() line: 1045
        ViewRoot.handleMessage(Message) line: 1727
        ViewRoot(Handler).dispatchMessage(Message) line: 99
        Looper.loop() line: 123
        ActivityThread.main(String[]) line: 4627
        Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
        Method.invoke(Object, Object...) line: 521
        ZygoteInit$MethodAndArgsCaller.run() line: 868
        ZygoteInit.main(String[]) line: 626
        NativeStart.main(String[]) line: not available [native method]

        Show
        Karl Rowley added a comment - When these two lines of Javascript code are removed, there is no failure: borderColor: 'transparent', borderWidth: 0, This is the first place I see a problem: Thread [<1> main] (Suspended (exception IllegalStateException)) <VM does not provide monitor information> ListView.layoutChildren() line: 1662 ListView(AbsListView).onLayout(boolean, int, int, int, int) line: 1147 ListView(View).layout(int, int, int, int) line: 7035 TiTableView(FrameLayout).onLayout(boolean, int, int, int, int) line: 333 TiTableView.onLayout(boolean, int, int, int, int) line: 555 TiTableView(View).layout(int, int, int, int) line: 7035 TiCompositeLayout.onLayout(boolean, int, int, int, int) line: 583 TiCompositeLayout(View).layout(int, int, int, int) line: 7035 TiCompositeLayout.onLayout(boolean, int, int, int, int) line: 583 TiCompositeLayout(View).layout(int, int, int, int) line: 7035 FrameLayout.onLayout(boolean, int, int, int, int) line: 333 FrameLayout(View).layout(int, int, int, int) line: 7035 LinearLayout.setChildFrame(View, int, int, int, int) line: 1249 LinearLayout.layoutVertical() line: 1125 LinearLayout.onLayout(boolean, int, int, int, int) line: 1042 LinearLayout(View).layout(int, int, int, int) line: 7035 PhoneWindow$DecorView(FrameLayout).onLayout(boolean, int, int, int, int) line: 333 PhoneWindow$DecorView(View).layout(int, int, int, int) line: 7035 ViewRoot.performTraversals() line: 1045 ViewRoot.handleMessage(Message) line: 1727 ViewRoot(Handler).dispatchMessage(Message) line: 99 Looper.loop() line: 123 ActivityThread.main(String[]) line: 4627 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 521 ZygoteInit$MethodAndArgsCaller.run() line: 868 ZygoteInit.main(String[]) line: 626 NativeStart.main(String[]) line: not available [native method]
        Hide
        Karl Rowley added a comment -

        Someone in the Core Team needs to look at this ticket

        Show
        Karl Rowley added a comment - Someone in the Core Team needs to look at this ticket
        Hide
        Allen Yeung added a comment -

        Updated test case:

        var self = Ti.UI.createWindow({
        	backgroundColor : "#ffffff",
        	tabBarHidden : true
        });
        
        var tableViewData = [];
        
        var tableView = Ti.UI.createTableView({
        	// style:Titanium.UI.iPhone.TableViewStyle.GROUPED,
        });
        
        self.add(tableView);
        
        var headerView = Ti.UI.createView({
        	height : 90,
        	borderColor : 'green',
        	borderWidth : 5,
        	backgroundColor : 'red'
        });
        
        var headerImageContainer = Ti.UI.createView({
        	left : 19,
        	height : 64,
        	width : 64,
        	backgroundColor : 'blue'
        });
        
        headerImageContainer.add(Ti.UI.createView({
        	backgroundColor : 'yellow',
        	width : 64,
        	height : 64,
        	borderColor : '#a9a9a9',
        	borderRadius : 4,
        	borderWidth : 1,
        }));
        
        headerView.add(headerImageContainer);
        
        tableViewData.push(Ti.UI.createTableViewSection({
        	headerView : headerView,
        }));
        
        tableView.data = tableViewData;
        
        self.add(tableView);
        
        self.open();
        

        Expected Results:
        There should be a red view with a green border for the row. Inside the red view, there is a yellow view.

        Show
        Allen Yeung added a comment - Updated test case: var self = Ti.UI.createWindow({ backgroundColor : "#ffffff", tabBarHidden : true }); var tableViewData = []; var tableView = Ti.UI.createTableView({ // style:Titanium.UI.iPhone.TableViewStyle.GROUPED, }); self.add(tableView); var headerView = Ti.UI.createView({ height : 90, borderColor : 'green', borderWidth : 5, backgroundColor : 'red' }); var headerImageContainer = Ti.UI.createView({ left : 19, height : 64, width : 64, backgroundColor : 'blue' }); headerImageContainer.add(Ti.UI.createView({ backgroundColor : 'yellow', width : 64, height : 64, borderColor : '#a9a9a9', borderRadius : 4, borderWidth : 1, })); headerView.add(headerImageContainer); tableViewData.push(Ti.UI.createTableViewSection({ headerView : headerView, })); tableView.data = tableViewData; self.add(tableView); self.open(); Expected Results: There should be a red view with a green border for the row. Inside the red view, there is a yellow view.
        Show
        Allen Yeung added a comment - PR Ready: https://github.com/appcelerator/titanium_mobile/pull/3333
        Show
        Max Stepanov added a comment - 3_0_X PR https://github.com/appcelerator/titanium_mobile/pull/3468
        Hide
        Tamila Smolich (Inactive) added a comment -

        Closing as fixed. Tested on:
        Titanium Studio, build: 3.0.0.201211301903
        Titanium SDK, builds: 3.0.0.v20121130200208; 3.1.0.v20121203181001
        Devices: Samsung Galaxy S III (4.0.4)

        Show
        Tamila Smolich (Inactive) added a comment - Closing as fixed. Tested on: Titanium Studio, build: 3.0.0.201211301903 Titanium SDK, builds: 3.0.0.v20121130200208; 3.1.0.v20121203181001 Devices: Samsung Galaxy S III (4.0.4)

          People

          • Assignee:
            Allen Yeung
            Reporter:
            Lucian Pacurar
          • Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: