Titanium JIRA Archive
Alloy (ALOY)

[ALOY-731] Alloy: Ti.UI.textField: clearOnEdit being passed back as String instead of bool, causes crash

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-07-09T17:07:31.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.2.0, 2013 Sprint 14
ComponentsXML
Labelsandroid, qe-testadded
ReporterCarter Lathrop
AssigneeTony Lukasavage
Created2013-07-06T01:59:41.000+0000
Updated2013-07-15T23:45:14.000+0000

Description

NOTE: This is an android-only issue When setting clearOnEdit to true for a textField, it crashes the app. The error reads:
[ERROR][TiApplication( 1596)] (main) [1996,1996] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{it.italiaonline.mysos/org.appcelerator.titanium.TiActivity}: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean; Titanium 3.1.1,2013/06/15 16:10,f7592c1
[ERROR][TiApplication( 1596)] java.lang.RuntimeException: Unable to start activity ComponentInfo{it.italiaonline.mysos/org.appcelerator.titanium.TiActivity}: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
...
*Alloy Test Case*
<Alloy>
    <TabGroup>
        <Tab icon="KS_nav_ui.png" title="SOS">
            <Window title="SOS">
 
            ...
            <TextField borderColor="#000000" borderRadius="5" borderStyle="Titanium.UI.INPUT_BORDERSTYLE_ROUNDED" borderWidth="1" clearOnEdit="true" height="7.49%" left="3%" top="20%" value="State" width="94.38%"/>
            </Window>
        </Tab>
        ...
    </TabGroup>
</Alloy>
*Working as Expected in Ti Standard*
var win = Ti.UI.createWindow({
	backgroundColor: 'gray',
    layout: 'vertical'
    }),
    textArea1 = Ti.UI.createTextField({
    	clearOnEdit: true,
    	value:"this should clear",
    	width: '50%'
    });
   textArea2 = Ti.UI.createTextField({
   	top: 20,
    	clearOnEdit: true,
    	value:"this should clear",
    	width: '50%'
    });

    win.add(textArea1);
    win.add(textArea2);
    win.open();

Comments

  1. Carter Lathrop 2013-07-06

    From Q&A: http://developer.appcelerator.com/question/154507/android-emulator-error-textfield-clearonedit-property-app-crash
  2. Tony Lukasavage 2013-07-09

    PR: https://github.com/appcelerator/alloy/pull/169 test app: https://github.com/appcelerator/alloy/tree/master/test/apps/testing/ALOY-731 Functional test passes by running the app on android and ensuring that it runs without exception and that the appropriate TextFields and TextAreas either do or do not clear on edit. hintText is provided to easily identify the appropriate behaviors for each control.
  3. Federico Casali 2013-07-15

    Verified as fixed. Environment: Titanium SDK 3.1.2.v20130710144553 Appcelerator Studio 3.1.2.201307101037 Alloy 1.2.0 Closing.

JSON Source