Hi guys - I'm trying to get my head around this one and am having an issue with the ImageView control.
This code fails to load the image on the device (Android OS: 2.3.6), but works in the emulator (designed for Android OS 2.3.3):
var window = Ti.UI.createWindow({ title: 'blah' }); window.add(Titanium.UI.createImageView({ width: 150, image: 'http://developer.appcelerator.com/assets/img/DEV_titmobile_image.png' })); window.open();Changing the image source to be
'images/options.png' works as it should.
DDMS reports:
[D] Retrying bitmap decode: 5/5 [W] Bitmap bounds could not be determined. If bitmap is loaded, it won't be scaled. [E] Max retries reached, giving up decoding image sourceI am using SDK 1.7.5 in Titanium Studio 1.0.6
Am I missing something?
3 Answers
Turns out the answer was to delete the [package name]/remote-image-cache directory from the sdcard of the device.
Not sure why this was needed, though. Perhaps it had reached it's allowance of file size or something? There were quite a few image cache files in there.
Thanks for your help on this.
i've suffered from the same issue...the problem is that the image u r fetching is higher in the memory size than the memory size alloted to imageview.U can overcome this issue by compressing ur image during u fetch if, by making slight changes in the imageView property. If u need some test code then i can post.hope this suggestion will help u.
use following:
var window = Ti.UI.createWindow({ title: 'blah' }); var imageView = Titanium.UI.createImageView({ top:0, left: 0, right: 0 }) window.add(imageView); window.open(); var URL = 'http://antoniofarinha.com/blog/wp-content/uploads/2009/08/barney-stinson.jpg' var c = Titanium.Network.createHTTPClient(); c.setTimeout(10000); c.onload = function() { if(c.status == 200) { imageView.image = this.responseData; } } c.open('GET', URL); c.send();
Your Answer
Think you can help? Login to answer this question!