[TIMOB-2853] Android: Creating Button or ImageView Opacity to 1 Causes Null Reference Exception
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-11-05T13:58:34.000+0000 |
Affected Version/s | Release 1.6.0 |
Fix Version/s | Sprint 2011-25, Release 1.7.2, Release 1.8.0 |
Components | Android |
Labels | n/a |
Reporter | Dawson Toth |
Assignee | Bill Dawson |
Created | 2011-04-15T03:31:11.000+0000 |
Updated | 2011-11-05T13:58:34.000+0000 |
Description
Problem
Creating a Ti.UI.ImageView or a Ti.UI.Button with an opacity of 1 causes a Null Reference Exception to be thrown on Android. An opacity less than 1 works fine, such as 0.5.
This might affect other controls, but I saw it happening on image views and buttons in particular. I believe Ti.UI.View doesn't have this problem (you can create it with an opacity of 1 and it works just fine).
Expected Behavior
No exception should be thrown.
Tested On
Titanium Mobile 1.6.0 (Jan 06 2011)
BROKEN on Android Simulator 2.2
WORKS on iPhone Simulator 4.2
Sample Code
var win = Ti.UI.createWindow({ title: 'Opacity Fail!', backgroundImage: 'default.png' });
win.add(Ti.UI.createImageView({
image: 'KS_nav_ui.png',
opacity: 1,
top: 0, right: 0, left: 0, height: 200
}));
win.add(Ti.UI.createButton({
title: 'I am a button! Awesome, eh?',
opacity: 1,
bottom: 0, right: 0, left: 0, height: 200
}));
win.open();
Trace Log
Attached.
Associated Helpdesk Ticket
http://developer.appcelerator.com/helpdesk/view/61351#c308231">http://developer.appcelerator.com/helpdesk/view/61351#c308231
Attachments
File | Date | Size |
---|---|---|
opacitycrashesandroidlog.rtf | 2011-04-15T03:31:11.000+0000 | 21517 |
This also affects UILabel elements:
We have enterprise level interest in this now.
Additional Helpdesk Ticket
http://developer.appcelerator.com/helpdesk/view/71201">http://developer.appcelerator.com/helpdesk/view/71201
I can confirm that opacity value of 1 (or 1.0) for image view kills the app on Ti Mobile 1.6.1 and Android 1.6.
For those looking for a workaround, if it isn't obvious, use 0.99 instead of 1.
There is additional interest in the fix of this bug: http://support-admin.appcelerator.com/display/QHT-63577-369
A test app that exercises a few more views/controls:
merge to 1_7_X
Tested with Nexus S 2.3.4 and Nexus One 2.2.2 with 1.7.2.v20110630161836
Standardizing summary and labels.