Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5879] Android - Expose "error" event in remote images

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-11-15T13:06:06.000+0000
Affected Version/sRelease 1.7.0
Fix Version/sSprint 2011-44, Release 1.8.0.1
ComponentsAndroid
Labelsmodule_imageview, qe-closed-3.3.0, qe-testadded
ReporterPedro Enrique
AssigneeAllen Yeung
Created2011-10-26T13:03:47.000+0000
Updated2020-03-10T15:35:20.000+0000

Description

Feature Request:

Expose "error" event in imageViews

Description

If a remote image fails to render, the console (DDMS) outputs the following:
ERROR/TiUIImageView(8390): (main) [20,7354] Max retries reached, giving up decoding image source: http://someimage
We need a way to catch that error in the Javascript so that we can act accordingly, for example, show an "error_image.png".

Example:

var img = Ti.UI.createImageView({
	image:'http://someurl.com/someimage.png'
});
win.add(img);
img.addEventListener('error', function(){
	img.image = 'error_image.png';
});

Comments

  1. Priya Agarwal 2014-07-01

    Verified with: Appcelerator-Studio:3.3.0.201406271159 Sdk:3.3.0.v20140627202512 acs:1.0.14 alloy:1.4.0-rc3 npm:1.3.2 titanium:3.3.0-rc4 titanium-code-processor:1.1.1 xcode:5.1.1 OS:Maverick(10.9.3) Device : LG-P970(V4.0.4),iPhone5S(v7.1.1) error event is being fired. Working as expected. Hence closing the issue.

JSON Source