[AC-3035] Android: Custom TableViewSection in ScrollableView crash
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2013-04-02T18:28:47.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | scrollableview, tableview |
Reporter | Sebastien |
Assignee | Mauro Parra-Miranda |
Created | 2012-06-28T07:40:46.000+0000 |
Updated | 2016-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
File | Date | Size |
---|---|---|
app.js | 2012-07-05T06:20:55.000+0000 | 987 |
Not reproducible with the example source code. Proper app.js would be helpful.
I fixed the code and attached "app.js" file. I hope you could reproduce now . thank you
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
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
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.