Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2729] Android: runtime errors and intermittent crash when removing values from picker

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-07-11T09:46:56.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sRelease 3.0.0, Sprint 2012-18 API
ComponentsAndroid
Labelsapi, module_picker, qe-testadded
ReporterThomas Huelbert
AssigneePing Wang
Created2011-04-15T03:28:01.000+0000
Updated2013-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

Comments

  1. Junaid Younus 2012-08-24

    Tested on a Samsung Galaxy S2 using TiSDK 2.2.0v20120821095711, issue still valid.
       Location: [77,20] examples/picker_android_spinner_text.js
       
       Message: Uncaught error: Invalid value, expected type Object.
       
       Source: picker.columns[0].removeRow(picker.columns[0].rows[3]);
       
  2. Ping Wang 2012-08-29

    For functional test: 1. KS->Controls->Picker->Android "useSpinner"-text. Click "Remove all idx 3" 8 times. Check the log and see the output:
       W/PickerColumnProxy( 4370): Unable to remove the row. Invalid type for row.
       
    2. Run the sample code below. Click 'Add "Manny"'. Check the log and see the output:
       W/PickerColumnProxy( 4859): Unable to add the row. Invalid type for row.
       
    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(); 
       
  3. Ping Wang 2012-08-29

    PR https://github.com/appcelerator/titanium_mobile/pull/2852
  4. Natalie Huynh 2012-12-05

    Tested with Droid 1 2.2.3 with 3.0.0.v20121204144658
  5. Priya Agarwal 2013-07-11

    Reopening just to update the label
  6. Priya Agarwal 2013-07-11

    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

JSON Source