{ "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.
\nBreakdown is assigning height / width of an imageView using\n'dp's crashes.
\nEnterprise ticket here: http://developer.appcelerator.com/helpdesk/view/70571
\nusing 'dip' does not work either.
\nReproducible 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
Bill, here is a similar use case that also throws an exception\nand crashes the application:
\nvar win = Ti.UI.createWindow({
\nbackgroundColor:'red',
\n
\n});
\nvar a = Titanium.UI.createTextField({
\n height:'51dp',\n top:'5dp',\n paddingLeft:'10dp',\n left:'10dp',\n right:'54dp'\n });
\n
\nvar fieldContainer = Ti.UI.createView({
\n height:a.height,\n width:320,\n layout:'horizontal'
\n
\n});
\nfieldContainer.add(a);
\nwin.add(fieldContainer);
\nwin.open();
Stack Trace:
\nTRACE] 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)
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
(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...
verified on emulator 2.2.
\nCreating the image view with dp does not result in\nexception.