Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3035] Android: Custom TableViewSection in ScrollableView crash

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-04-02T18:28:47.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsscrollableview, tableview
ReporterSebastien
AssigneeMauro Parra-Miranda
Created2012-06-28T07:40:46.000+0000
Updated2016-03-08T07:48:04.000+0000

Description

*Problem description* If I put a tableview with custom tabelviewsection in a scrollableview, when I click on row and use addView method of scrollableView the application crashes. *Code snippet*
(function() {
    //create component instance
    var self = Ti.UI.createWindow({
        backgroundColor:'#ffffff',
        navBarHidden:true,
        exitOnClose:true
    });
        

    var tableView = Ti.UI.createTableView();  
    
    var oneSection = Ti.UI.createTableViewSection({
       headerView: Ti.UI.createView({
           height: '25dp',
           backgroundColor: '#F00'
       })
    });
    
    for (var i=0; i < 20; i++) {
        oneSection.add(Ti.UI.createTableViewRow({
            title: 'coucou' + i,
            height: '40dp'
        }))  
    };   
    tableView.setData([oneSection]);
        
    var scrollView = Ti.UI.createScrollableView({
        views: [tableView]
    });
    self.add(scrollView);

    
    var secondView = Ti.UI.createView({
       backgroundColor: '#F00'
    });
    
    
    tableView.addEventListener('click', function(item) {
       
       // crash HERE !!!!!!

       scrollView.addView(secondView);      
       scrollView.moveNext();
       
        
    });
	
    self.open();
})();

Attachments

FileDateSize
app.js2012-07-05T06:20:55.000+0000987

Comments

  1. Anirudh Nagesh 2012-07-03

    Not reproducible with the example source code. Proper app.js would be helpful.
  2. Sebastien 2012-07-05

    I fixed the code and attached "app.js" file. I hope you could reproduce now . thank you
  3. Anirudh Nagesh 2012-07-17

    Hi, You need to remove the views inside scrollable view before adding a new view. Use 'scrollView.removeView(tableView)' before you add secondView inside table click. this will fix the issue. Regards, Anirudh
  4. Sebastien 2012-07-18

    Hi, Thank you for your answer. When I remove the previous view, it works but I lose transition effect and the possibility to use movePrevious to back on the first view. I think the issue comes from tableview in processProperties method. This method already have a problem with searchbar because it add the same instance without remove previous parent. And for custom section, I think it's the same king of issue. Regards, Seb
  5. Daniel Sefton 2013-04-02

    Cannot reproduce with Ti SDK 3.0.2 GA with Samsung Galaxy S2 Android 2.3.6. Tapping any of the rows opens the view without crashing.

JSON Source