[TIMOB-11484] Android: Imageview: App is giving null pointer exception if value of image is given as '../image/xxx.jpg', which works fine for iOS.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2012-12-07T19:49:05.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | 2012 Sprint 25, 2012 Sprint 25 API |
Components | Android |
Labels | api, qe-and100112 |
Reporter | Shyam Bhadauria |
Assignee | Ping Wang |
Created | 2012-10-15T09:54:12.000+0000 |
Updated | 2013-11-07T18:30:39.000+0000 |
Description
This is not a regression. It exists as far as 2.0.1.
When the value of image is given as '/image/xxx.jpg' , it works fine. But using '../image/xxx.jpg crashes the app which works fine in iOS.
This issue is replicated when contentURL value is given as '../xxxx.mp4' instead of '/xxxx.mp4'.
Steps to reproduce:
1. Use the code below in app.js and paste the attached image of flower in 'images' folder under resource in the app.
var win = Ti.UI.createWindow();
win.backgroundColor = 'white';
var label = Ti.UI.createLabel({
text: 'ImageView should auto size to image and stay within the blue',
top: 20,
left: 10,
height: Ti.UI.SIZE,
width: Ti.UI.SIZE,
color: 'black'
});
var view1 = Ti.UI.createView({
height: 30,
width: 60,
top: 80,
backgroundColor: 'red'
});
var imageView1 = Ti.UI.createImageView({
image: '../images/flower.jpg',
backgroundColor: 'blue'
});
view1.add(imageView1);
win.add(view1);
win.add(label);
win.open();
2. Run the app.
Expected result:
1. App should run and show an imageview with flower image in it.
Actual result:
1. App crashes with null pointer exception.Logs are attached.
Attachments
File | Date | Size |
---|---|---|
flower.jpg | 2012-10-15T09:54:12.000+0000 | 17766 |
ImageView_Exception.rtf | 2012-10-15T09:54:12.000+0000 | 6415 |
The NPE does not show any more on Android using the latest master. But the flower image is not shown with the log:
Also tested on iOS, the flower image is not shown either.
In the original test case, flower.jpg is under the folder Resources/images, so the expected result should be: App should run without crash but the flower image won't show. Run the modified test case below and paste the attached flower.jpg under the folder Resources/images:
Expected Result: App runs without crash and the flower image shows correctly. The original and modified test cases run as expected. Mark the ticket as Cannot Reproduce.
Original test case still crashes(gives NPE) with build 3.1.0.v20130228214607 on device LG-P970 Android 2.2.2 but not over other devices.Tested with Samung GALAXY Tab 620 Android 3.2 and Samsung GALAXY Note Android 2.3.6 as well. The modified test case is working fine on all android devices.Image still do not appears on iOS(tested with iphone 5 iOS 6.0 and ipad 3 iOS 6.0) with modified test case.
Modified case is working fine on android.So closing the bug.