[TIMOB-4757] Android: ImageView doesn't show the image
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2012-02-07T10:14:57.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Aleix Casagolda |
Assignee | Neeraj Gupta |
Created | 2011-06-10T01:26:52.000+0000 |
Updated | 2017-03-24T18:33:51.000+0000 |
Description
I've added an ImageView to the Window and the image doesn't show in the emulator. I've tested it on a Nexus S device and in the device the app crashes. If I remove the ImageView, the app doesn't crash in the device.
The same code works in mobile SDK 1.6.2 on Windows and using the same 1.7 SDK in Linux, it works well so it could be a bug that only affects Windows version of the SDK?
Ti.UI.backgroundColor = "#FFFFFF";
var win = Ti.UI.createWindow({
modal:true
});
var myimage = Ti.UI.createImageView({
image: '/image.jpg'
});
win.add(myimage);
win.open();
Attachments
File | Date | Size |
---|---|---|
image.jpg | 2011-06-25T04:56:54.000+0000 | 692 |
Aleix Please try this using the latest Titanium SDK 1.7.X, and report back stating the build date and hash tested. Many thanks
Hi Paul, I've tested it again with Titanim SDK 1.7.1 06/13/11 15:33 with hash 84a68cc Still doesn't load the image in the Emulator (tested on Android SDK 2.3.1 and 2.3.3) and crashes when the app loads in device Nexus S (Android 2.3.4) Thanks.
Aleix Your code works without issue on my system, a Android 2.3.3 emulator and Titanium 1.7.1 (2011/06/17 00:13 293a6d...). However, I really do think it's a false economy when you reduce the code's readability by saving a line or two of code. I have updated the usecase with what I would use. Would you mind confirming that you still experience the same issue using it? The only thing I can think of is that your image file is not in a valid format. I have attached an image file that works on my system.
Hi Paul, Thank you for your reply. I've tested again using your code and your image with the latest version of Titanium I've found (1.7.1 06/21/11 14:28 1293a6d) and I'm still having the same error using the emulator (Android 2.3.3): image doesn't show and I'm still having the same issue on my device (Samsung Nexus S with Android 2.3.4): the app crashes on startup. I've seen this message in the stackTrace (I don't know if it's useful for you): W/TiDrawableReference( 673): (main) [5,616] Bitmap bounds could not be determined. If bitmap is loaded, it won't be scaled. I'm using Windows 7 64 bits and of course, Titanium mobile SDK for Windows. I tested it some days ago using the Linux SDK in an Ubuntu VM and it worked well. Thanks.
I can confirm Aleix's findings. I installed Studio on my Windows Vista development computer as I was keen to try the Blackberry SDK, after a number of failures in getting it to work I decided that the three year old machine was due a clean up. I have re-installed Windows Vista from scratch, clean install on reformated drive, not a repair or upgrade. The only software installed other than Titanium Studio and it's dependancies is MS Office. I have imported a project that previously worked (as far as it had got) and all imageViews are blank. They are all there and respond to touch events, they just don't show the image. I initially assumed that it was an issue with the images so tried converting the png to jpg and gif, no luck. As the image was being resized and 1.7 raises some issues with resizing I created images in all three formats at the correct size, still no luck. After that I decided that Titanium had to be the issue and followed the advice on the Titanium Q&A to disable FastDev and that made the app work correctly, but only once. When I altered the app and redeployed it was broken again. Whilst I appreciate that you cannot test every environment, and Vista is not a supported OS (XP & 7 are ??!!) I assumed that this would mean a loss of functionality like FastDev not working, not my apps being trashed. This sort of catastrophic failure deserves a serious warning, (like DO NOT UNDER ANY CIRCUMSTANCES INSTALL ON WINDOWS VISTA IT WON'T WORK AND YOUR APP WILL NOT RUN), not 'Vista is not supported'. And whilst you cannot duplicate this on Windows 7, it is real, and it is a showstopper, IT NEEDS FIXING.
OK, Aleix What we need is a full trace log when running 1.7.X + Android 2.3.3 in an emulator. Would you be able to provide this? Once this is done, I will move the ticket over to the mobile project. Just to note, see the [Jira Ticket Checklist](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-Summary%3AJiraTicketChecklist) to see what is required for most tickets. Many thanks
Hi Paul, Thanks. The log. Let me know if you need something more.
Aleix Please remember to use the code block markup provided. Thanks. I'm moving this to the main project for the core team to review. Cheers
Still seeing this in SDK 1.8.1 on win64 (image not displaying in ImageView on the android-emulator) 2 observations:
it works with remote URLs (even when fastdev is enabled):
it works with local URLs only when fastdev is disabled
So it seems this is a problem with fastdev on the windows platform: [http://developer.appcelerator.com/question/121031/titanium-studio-and-mobile-sdk-17-createimageview-no-longer-works]Worked on in the newer ticket.
Closing ticket as duplicate with reference to the linked issues.