{ "id": "63679", "key": "TIMOB-3047", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "6", "description": "", "name": "Hold" }, "resolutiondate": "2011-04-15T03:35:28.000+0000", "created": "2011-04-15T03:35:26.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "defect", "enterprise", "release-1.7.0", "reported-1.6.0", "rplist" ], "versions": [], "issuelinks": [], "assignee": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2017-03-10T19:23:39.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}

(From Andreas Sandberg) Bill, here is a similar use case that\nalso throws an exception and crashes the application:

\n
\nvar win = Ti.UI.createWindow({\nbackgroundColor:'red',\n});\nvar a = Titanium.UI.createTextField({\n        height:'51dp',\n        top:'5dp',\n        paddingLeft:'10dp',\n        left:'10dp',\n        right:'54dp'\n    });\nvar fieldContainer = Ti.UI.createView({\n        height:a.height,\n        width:320,\n        layout:'horizontal'\n});\nfieldContainer.add(a);\nwin.add(fieldContainer);\nwin.open();\n
\n

Stack Trace:

\n
\n[TRACE] E/KrollReflectionProperty( 559): (kroll$1) [702,1358] Exception getting/setting property: height\n[TRACE] E/KrollReflectionProperty( 559): java.lang.NumberFormatException: unable to parse '51dp' as integer \n[TRACE] E/KrollReflectionProperty( 559): at java.lang.Integer.parse(Integer.java:433) \n[TRACE] E/KrollReflectionProperty( 559): at java.lang.Integer.parseInt(Integer.java:422) \n[TRACE] E/KrollReflectionProperty( 559): at java.lang.Integer.parseInt(Integer.java:382) \n[TRACE] E/KrollReflectionProperty( 559): at org.appcelerator.titanium.util.TiConvert.toInt(TiConvert.java:251) \n[TRACE] E/KrollReflectionProperty( 559): at org.appcelerator.titanium.proxy.TiViewProxy.getHeight(TiViewProxy.java:303) \n[TRACE] E/KrollReflectionProperty( 559): at org.appcelerator.titanium.proxy.TiViewProxyBindingGen$2.dynamicGet(TiViewProxyBindingGen.java:276) \n[TRACE] E/KrollReflectionProperty( 559): at org.appcelerator.kroll.KrollDynamicProperty.safeInvoke(KrollDynamicProperty.java:39) \n[TRACE] E/KrollReflectionProperty( 559): at org.appcelerator.kroll.KrollDynamicProperty.get(KrollDynamicProperty.java:88) \n[TRACE] E/KrollReflectionProperty( 559): at org.appcelerator.kroll.KrollProxy.getDynamicProperty(KrollProxy.java:241) \n[TRACE] E/KrollReflectionProperty( 559): at org.appcelerator.kroll.KrollProxy.get(KrollProxy.java:183) \n[TRACE] E/KrollReflectionProperty( 559): at org.appcelerator.kroll.KrollObject.get(KrollObject.java:33) \n[TRACE] E/KrollReflectionProperty( 559): at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1963) \n[TRACE] E/KrollReflectionProperty( 559): at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1503) \n[TRACE] E/KrollReflectionProperty( 559): at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1489)\n
{html}", "attachment": [], "flagged": false, "summary": "Android: TextField crashes when 'dp' units used to set dimension properties", "creator": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "129931", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

Simplified failcase app.js:

\n
\nvar v = Ti.UI.createView({height: '50dp'});\nvar h = v.height;\n
{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:35:26.000+0000", "updated": "2011-04-15T03:35:26.000+0000" }, { "id": "129932", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Bill, I spoke with the customer and we're pushing this to 1.7.0.\nAs you know, it requires changing method signatures and dealing\nwith the static vs dynamic problem we found in our UI review in\nJanuary.

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:35:27.000+0000", "updated": "2011-04-15T03:35:27.000+0000" }, { "id": "129933", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

Also slated for 1.7.0 is a general re-working of the properties\nthat set and expose layout characteristics. For example, currently\nit is impossible to read that you set a width to\n\"auto\". (It throws the exception that is the subject\nof this ticket.) One of the goals of the overhaul is that\ndifferentiate between what you set as a layout dimension (\"11\",\n\"11dp\", \"auto\", etc.) and the actual pixel dimension that resulted\nonce the view was laid out. At that point, this ticket will not be\nvalid anymore.

\n

To avoid duplicate effort, we're therefore putting this ticket\nin a hold state, since both this ticket and the general re-working\n(which will solve this ticket) are slated for 1.7.0.

\n

As a temporary workaround to the exception that you're getting\nas described in this ticket, you can read the .size\nproperty of views. For example, if you set view.width =\n\"20dp\", you can then read the resulting width (expressed in\npixels) with view.size.width, but only\nafter the view has been laid out (i.e., after the\nwindow has been open and all child views have been drawn.)

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:35:28.000+0000", "updated": "2011-04-15T03:35:28.000+0000" }, { "id": "411330", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-10T19:23:39.000+0000", "updated": "2017-03-10T19:23:39.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }