{ "id": "63671", "key": "TIMOB-3039", "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": [ { "id": "11241", "name": "Release 1.6.0 M08", "archived": true, "released": true, "releaseDate": "2011-02-07" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T02:00:45.000+0000", "created": "2011-04-15T03:35:15.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "2.2", "android", "defect", "enterprise", "release-1.6.0", "reported-1.6.0", "rplist" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T02:00:45.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}

Unsure if this is a feature request or defect.

\n

Breakdown is assigning height / width of an imageView using\n'dp's crashes.

\n

Enterprise ticket here: http://developer.appcelerator.com/helpdesk/view/70571

\n

using 'dip' does not work either.

\n

Reproducible code:

\n
\nvar win = Ti.UI.createWindow({\n    backgroundColor:'red',\n});\n \n \nvar a =  Titanium.UI.createImageView({\n            height:'48dp',\n            width:'48dp',\n            top:'12dp',\n            left:'18dp',\n            image:'icon_default_white_48.png',\n            defaultImage:'icon_default_white_48.png',\n        });\n \nwin.add(a);\nwin.open();\n
{html}", "attachment": [], "flagged": false, "summary": "Android: DP unit for imageView causes crash", "creator": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "subtasks": [], "reporter": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "environment": null, "comment": { "comments": [ { "id": "129919", "author": { "name": "andreassandberg", "key": "andreassandberg", "displayName": "Andreas sandberg", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Bill, here is a similar use case that also throws an exception\nand crashes the application:

\n

var win = Ti.UI.createWindow({

\n
\nbackgroundColor:'red',\n
\n

});

\n

var a = Titanium.UI.createTextField({

\n
\n        height:'51dp',\n        top:'5dp',\n        paddingLeft:'10dp',\n        left:'10dp',\n        right:'54dp'\n    });\n
\n

var fieldContainer = Ti.UI.createView({

\n
\n        height:a.height,\n        width:320,\n        layout:'horizontal'\n
\n

});

\n

fieldContainer.add(a);
\nwin.add(fieldContainer);
\nwin.open();

\n

Stack Trace:

\n

TRACE] E/KrollReflectionProperty( 559): (kroll$1) [702,1358]\nException getting/setting property: height
\n[TRACE] E/KrollReflectionProperty( 559):\njava.lang.NumberFormatException: unable to parse '51dp' as integer\n[TRACE] E/KrollReflectionProperty( 559): at\njava.lang.Integer.parse(Integer.java:433) [TRACE] E/KrollReflectionProperty( 559): at\njava.lang.Integer.parseInt(Integer.java:422) [TRACE] E/KrollReflectionProperty( 559): at\njava.lang.Integer.parseInt(Integer.java:382) [TRACE] E/KrollReflectionProperty( 559): at\norg.appcelerator.titanium.util.TiConvert.toInt(TiConvert.java:251)\n[TRACE] E/KrollReflectionProperty( 559): at\norg.appcelerator.titanium.proxy.TiViewProxy.getHeight(TiViewProxy.java:303)\n[TRACE] E/KrollReflectionProperty( 559): at\norg.appcelerator.titanium.proxy.TiViewProxyBindingGen$2.dynamicGet(TiViewProxyBindingGen.java:276)\n[TRACE] E/KrollReflectionProperty( 559): at\norg.appcelerator.kroll.KrollDynamicProperty.safeInvoke(KrollDynamicProperty.java:39)\n[TRACE] E/KrollReflectionProperty( 559): at\norg.appcelerator.kroll.KrollDynamicProperty.get(KrollDynamicProperty.java:88)\n[TRACE] E/KrollReflectionProperty( 559): at\norg.appcelerator.kroll.KrollProxy.getDynamicProperty(KrollProxy.java:241)\n[TRACE] E/KrollReflectionProperty( 559): at\norg.appcelerator.kroll.KrollProxy.get(KrollProxy.java:183) [TRACE] E/KrollReflectionProperty( 559): at\norg.appcelerator.kroll.KrollObject.get(KrollObject.java:33)\n[TRACE] E/KrollReflectionProperty( 559): at\norg.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1963)\n[TRACE] E/KrollReflectionProperty( 559): at\norg.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1503)\n[TRACE] E/KrollReflectionProperty( 559): at\norg.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1489)

{html}", "updateAuthor": { "name": "andreassandberg", "key": "andreassandberg", "displayName": "Andreas sandberg", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:35:16.000+0000", "updated": "2011-04-15T03:35:16.000+0000" }, { "id": "129920", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

The TextField issue is similar in the sense that it happens with\n'dp', but it actually has a different root cause so I put it in its\nown ticket: #3047

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:35:16.000+0000", "updated": "2011-04-15T03:35:16.000+0000" }, { "id": "129921", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

(from [6f78b58b06affa14ab0ab8188ea98f6969e415ba])\nFor dp and % units, view's parent is required, and imageview needs\nit 'earlier' that most other views so that image scaling can occur.\nModify ImageView.getParent to find the parent view via the parent's\nproxy in case the imageview view hasn't yet been added to the\nparent view. [#3039 state:fixed-in-qa] \nhttps://github.com/appcelerator/titanium_mobile/commit/6f78b58b06af...

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:35:17.000+0000", "updated": "2011-04-15T03:35:17.000+0000" }, { "id": "129922", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "{html}

verified on emulator 2.2.

\n

Creating the image view with dp does not result in\nexception.

{html}", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2011-04-15T03:35:17.000+0000", "updated": "2011-04-15T03:35:17.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }