[TIMOB-2729] Android: runtime errors and intermittent crash when removing values from picker
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2013-07-11T09:46:56.000+0000 |
| Affected Version/s | Release 3.0.0 |
| Fix Version/s | Release 3.0.0, Sprint 2012-18 API |
| Components | Android |
| Labels | api, module_picker, qe-testadded |
| Reporter | Thomas Huelbert |
| Assignee | Ping Wang |
| Created | 2011-04-15T03:28:01.000+0000 |
| Updated | 2013-07-11T09:46:56.000+0000 |
Description
goes back to 1.5.1. found in 1.6.0 (01/03/11 08:14 11dd2b6), droid 1 (2.2.1)
1.Controls> Picker > Android "useSpinner" - text
2. Tap "remove" 8 times
results: run time error
location:
76,0 app://examples/picker_android_spnner_text.js#76
message:Wrapped java.lang.ClassCastException: org.appcelerator.kroll.KrollProxy$1 (app:/examples/picker_android_spinner_text.js #76
This crashed on the droid1 log here: http://pastie.org/1426843">http://pastie.org/1426843
Tested on a Samsung Galaxy S2 using TiSDK 2.2.0v20120821095711, issue still valid.
For functional test: 1. KS->Controls->Picker->Android "useSpinner"-text. Click "Remove all idx 3" 8 times. Check the log and see the output:
2. Run the sample code below. Click 'Add "Manny"'. Check the log and see the output:Sample code:var w = Ti.UI.createWindow({ backgroundColor : 'black' }); var status = Ti.UI.createLabel({ top : 5, left : 5, right : 5, height : 40, textAlign : 'center' }); w.add(status); function showStatus(s) { status.text = s; } var names = ['Joanie', 'Mickey', 'Jean-Pierre', 'Gustav', 'Raul', 'Mimi', 'Emily', 'Sandra', 'Carrie', 'Chachi']; var verbs = ['loves', 'likes', 'visits', 'loathes', 'waves to', 'babysits', 'accompanies', 'teaches', 'announces', 'supports', 'knows', 'high-fives']; var rows1 = []; for (var i = 0; i < names.length; i++) { rows1.push(Ti.UI.createPickerRow({ title : names[i] })); } var rows2 = []; for ( i = 0; i < verbs.length; i++) { rows2.push(Ti.UI.createPickerRow({ title : verbs[i] })); } var rows3 = []; for ( i = (names.length - 1); i >= 0; i--) { rows3.push(Ti.UI.createPickerRow({ title : names[i] })); } var column1 = Ti.UI.createPickerColumn({ rows : rows1, font : { fontSize : "12" } }); var column2 = Ti.UI.createPickerColumn({ rows : rows2, font : { fontSize : "12" } }); var column3 = Ti.UI.createPickerColumn({ rows : rows3, font : { fontSize : "12" } }); var picker = Ti.UI.createPicker({ useSpinner : true, visibleItems : 7, type : Ti.UI.PICKER_TYPE_PLAIN, top : 150, height : 200, columns : [column1, column2, column3] }); picker.addEventListener('change', function(e) { showStatus(e.selectedValue[0] + " " + e.selectedValue[1] + " " + e.selectedValue[2]); }); w.add(picker); var btnAdd = Ti.UI.createButton({ left : 5, height : 40, top : 50, title : 'Add "Manny"' }); btnAdd.addEventListener('click', function() { picker.columns[0].addRow(Ti.UI.createPickerRow({ title : 'Manny' })); picker.columns[2].addRow(Ti.UI.createPickerRow({ title : 'Manny' })); picker.columns[1].addRow("something"); showStatus('"Manny" added to columns 0 & 2'); }); w.add(btnAdd); var btnRemove = Ti.UI.createButton({ left : 5, height : 40, top : 100, title : 'Remove all idx 8' }); btnRemove.addEventListener('click', function() { picker.columns[0].removeRow(picker.columns[0].rows[8]); picker.columns[1].removeRow(picker.columns[1].rows[8]); picker.columns[2].removeRow(picker.columns[2].rows[8]); showStatus("value at index 8 of each col. removed"); }); w.add(btnRemove); w.open();PR https://github.com/appcelerator/titanium_mobile/pull/2852
Tested with Droid 1 2.2.3 with 3.0.0.v20121204144658
Reopening just to update the label
Updated label and Verified under: Titanium Studio:3.1.2.201307091843 Titanium SDK: 3.1.2.v20130710144553 acs:1.0.3 alloy:1.1.3 npm:1.2.14 titanium:3.1.1 titanium-code-processor:1.0.1 OS: OSX 10.8 Device:Galaxy Nexus (v 4.0.4) Xcode: 4.5.1