{ "id": "63485", "key": "TIMOB-2853", "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": "11357", "description": "Mobile 1.8.0 M04", "name": "Sprint 2011-25", "archived": true, "released": true, "releaseDate": "2011-06-27" }, { "id": "11570", "description": "", "name": "Release 1.7.2", "archived": true, "released": true, "releaseDate": "2011-07-21" }, { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-11-05T13:58:34.000+0000", "created": "2011-04-15T03:31:11.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [ { "id": "11233", "name": "Release 1.6.0", "archived": true, "released": true, "releaseDate": "2011-02-23" } ], "issuelinks": [], "assignee": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2011-11-05T13:58:34.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}

Problem

\r\n

Creating a Ti.UI.ImageView or a Ti.UI.Button with an opacity of\r\n1 causes a Null Reference Exception to be thrown on Android. An\r\nopacity less than 1 works fine, such as 0.5.

\r\n

This might affect other controls, but I saw it happening on\r\nimage views and buttons in particular. I believe Ti.UI.View doesn't\r\nhave this problem (you can create it with an opacity of 1 and it\r\nworks just fine).

\r\n

Expected Behavior

\r\n

No exception should be thrown.

\r\n

Tested On

\r\n

Titanium Mobile 1.6.0 (Jan 06 2011)
\r\nBROKEN on Android Simulator 2.2
\r\nWORKS on iPhone Simulator 4.2

\r\n

Sample Code

\r\n
\r\nvar win = Ti.UI.createWindow({ title: 'Opacity Fail!', backgroundImage: 'default.png' });\r\nwin.add(Ti.UI.createImageView({\r\n    image: 'KS_nav_ui.png',\r\n    opacity: 1,\r\n    top: 0, right: 0, left: 0, height: 200\r\n}));\r\nwin.add(Ti.UI.createButton({\r\n    title: 'I am a button! Awesome, eh?',\r\n    opacity: 1,\r\n    bottom: 0, right: 0, left: 0, height: 200\r\n}));\r\nwin.open();\r\n
\r\n

Trace Log

\r\n

Attached.

\r\n

Associated Helpdesk Ticket

\r\n

http://developer.appcelerator.com/helpdesk/view/61351#c308231

{html}", "attachment": [ { "id": "18229", "filename": "opacitycrashesandroidlog.rtf", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-04-15T03:31:11.000+0000", "size": 21517, "mimeType": "text/rtf" } ], "flagged": false, "summary": "Android: Creating Button or ImageView Opacity to 1 Causes Null Reference Exception", "creator": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "environment": "BROKEN on Android Simulator 2.2; WORKS on iPhone Simulator 4.2", "comment": { "comments": [ { "id": "129556", "author": { "name": "andreassandberg", "key": "andreassandberg", "displayName": "Andreas sandberg", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

This also affects UILabel elements:

\n
\nvar win = Ti.UI.createWindow();\n \nvar registerLabel = Titanium.UI.createLabel(\n{\n    text: 'Stuff in here',\n    top:'320dp',\n    font: {\n        fontSize:'12sp'\n    }}\n);\n\nregisterLabel.opacity = 0;\n\nvar button = Ti.UI.createButton( {\n    title: \"Login\",\n    opacity: .2,\n    height:'51dp',\n    width:'300dp',\n    top:'240dp',\n    font: {\n        fontSize:'20sp', fontWeight:'bold'\n    }}\n);\nwin.add(button);\nwin.add(registerLabel);\n\nbutton.addEventListener('click', function(){\n    registerLabel.opacity = 1;\n});\n\nwin.open();\n
{html}", "updateAuthor": { "name": "andreassandberg", "key": "andreassandberg", "displayName": "Andreas sandberg", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:31:11.000+0000", "updated": "2011-04-15T03:31:11.000+0000" }, { "id": "129557", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "{html}

We have enterprise level interest in this now.

\n

Additional Helpdesk Ticket

\n

http://developer.appcelerator.com/helpdesk/view/71201

{html}", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-04-15T03:31:12.000+0000", "updated": "2011-04-15T03:31:12.000+0000" }, { "id": "129558", "author": { "name": "joeientry", "key": "joeientry", "displayName": "Joe iEntry", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I can confirm that opacity value of 1 (or 1.0) for image view\nkills the app on Ti Mobile 1.6.1 and Android 1.6.

\n

For those looking for a workaround, if it isn't\nobvious, use 0.99 instead of 1.

{html}", "updateAuthor": { "name": "joeientry", "key": "joeientry", "displayName": "Joe iEntry", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:31:12.000+0000", "updated": "2011-04-15T03:31:12.000+0000" }, { "id": "130871", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "There is additional interest in the fix of this bug:\n\nhttp://support-admin.appcelerator.com/display/QHT-63577-369", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-04-15T13:04:58.000+0000", "updated": "2011-04-15T13:04:58.000+0000" }, { "id": "157249", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "A test app that exercises a few more views/controls:\r\n\r\n{code:title=\"app.js\"}\r\nTitanium.UI.setBackgroundColor('#000');\r\nvar win = Ti.UI.createWindow({\r\n\ttitle: 'Opacity Fail!',\r\n\tbackgroundImage: 'default.png',\r\n\texitOnClose: true\r\n});\r\nwin.add(Ti.UI.createImageView({\r\n\timage: 'KS_nav_ui.png',\r\n\topacity: 0.8,\r\n\tleft: \"5dp\", width: \"50dp\", top: \"5dp\", height: \"50dp\"\r\n}));\r\nwin.add(Ti.UI.createImageView({\r\n\timage: 'KS_nav_ui.png',\r\n\topacity: 1,\r\n\tleft: \"60dp\", width: \"50dp\", top: \"5dp\", height: \"50dp\"\r\n}));\r\n\r\nwin.add(Ti.UI.createButton({\r\n\topacity: 0.8,\r\n\ttitle: \"opacity 0.8\",\r\n\tleft: \"5dp\", width: \"100dp\", top: \"70dp\", height: \"40dp\"\r\n}));\r\nwin.add(Ti.UI.createButton({\r\n\topacity: 1,\r\n\ttitle: \"opacity 1\",\r\n\tleft: \"110dp\", width: \"100dp\", top: \"70dp\", height: \"40dp\"\r\n}));\r\n\r\nwin.add(Ti.UI.createLabel({\r\n\topacity: 0.8,\r\n\ttext: \"opacity 0.8\",\r\n\tcolor: 'black',\r\n\tbackgroundColor: 'green',\r\n\tleft: \"5dp\", width: \"100dp\", top: \"115dp\", height: \"40dp\"\r\n}));\r\nwin.add(Ti.UI.createLabel({\r\n\topacity: 1,\r\n\ttext: \"opacity 1\",\r\n\tcolor: 'black',\r\n\tbackgroundColor: 'green',\r\n\tleft: \"110dp\", width: \"100dp\", top: \"115dp\", height: \"40dp\"\r\n}));\r\n\r\nwin.add(Ti.UI.createView({\r\n\topacity: 0.8,\r\n\tbackgroundColor: 'green',\r\n\tleft: '5dp', width: \"100dp\", top: \"160dp\", height: \"40dp\"\r\n}));\r\nwin.add(Ti.UI.createView({\r\n\topacity: 1,\r\n\tbackgroundColor: 'green',\r\n\tleft: '110dp', width: \"100dp\", top: \"160dp\", height: \"40dp\"\r\n}));\r\n\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-06-20T18:45:57.000+0000", "updated": "2011-06-20T18:45:57.000+0000" }, { "id": "157714", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "merge to 1_7_X", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-06-23T18:10:09.000+0000", "updated": "2011-06-23T18:10:09.000+0000" }, { "id": "158762", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with Nexus S 2.3.4 and Nexus One 2.2.2 with 1.7.2.v20110630161836", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-06T10:27:15.000+0000", "updated": "2011-07-06T10:27:15.000+0000" }, { "id": "171627", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Standardizing summary and labels.", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-11-05T13:58:15.000+0000", "updated": "2011-11-05T13:58:15.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }