Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15200] Android: ImageView.image from XHR no longer shows new image

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2013-09-18T18:59:30.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 19, 2013 Sprint 19 API, Release 3.1.3, Release 3.2.0
ComponentsAndroid
LabelsimageView, qe-closed-3.1.3, qe-testadded
ReporterNic Jansma
AssigneePing Wang
Created2013-09-15T23:43:08.000+0000
Updated2013-10-09T15:41:23.000+0000

Description

After installing SDK 3.1.3.v20130913160104 to verify the fix for TIMOB-14777 i.e. https://github.com/appcelerator/titanium_mobile/pull/4657 I have found that setting the .image property on an ImageView does not show the actual image. Here's a reduced repro (that can be placed into FirstView.js after creating a new project, for example):
var win = Ti.UI.createWindow();
function FirstView() {
    var imageView = Ti.UI.createImageView();
     
    var xhr = Ti.Network.createHTTPClient();
    xhr.onload = function() {
        imageView.image = xhr.responseData;
    };
     
    xhr.open('GET', 'http://nicj.net/wd-icon-small.png');
    xhr.send();
     
    return imageView;
}
var v = FirstView();

win.add(v);
win.open();
On SDK 3.1.2, the logo shows up. On SDK 3.1.3.v20130913160104, the logo does not show up. The XHR.onload event does fire, but it appears setting imageView.image has no effect. I suspect that it may be related to the fix I mention TIMOB-14777.

Attachments

FileDateSize
3.1.2.GA.png2013-09-18T16:51:25.000+000033808
3.1.3.png2013-09-18T16:51:25.000+000023929

Comments

  1. Philippe Wueger 2013-09-18

    I have this issue too. I assume that in TiUIImageView.java (lines 140 and 227)
       imgsrc.getUrl()
       
    returns null, when an image is set from a blob. With the fix mentioned in the description, the image bitmap will never be set in this case.
  2. Philippe Wueger 2013-09-18

    Pull Request for my fix: https://github.com/appcelerator/titanium_mobile/pull/4710
  3. Olga Romero 2013-09-18

    The bug is reproducible with: Appcelerator Studio, build: 3.1.3.201309132456 Titanium SDK, build: 3.1.3.v20130917141554 CLI 3.1.2 Alloy 1.2.2-cr code-processor 1.0.3-cr GalaxyS3 Android version 4.0.4 See screenshots
  4. Hieu Pham 2013-09-18

    master PR: https://github.com/appcelerator/titanium_mobile/pull/4711 3.1.x PR: https://github.com/appcelerator/titanium_mobile/pull/4712
  5. Ping Wang 2013-09-18

    [~philet] thanks very much for your work. Your PR is great. The only problem is the additional check is not necessary for the method handleCacheAndSetImage which is only used in downloadListener, since the downloaded image must have a url. Due to the tight time schedule for the release 3.1.3, I submitted another PR which only adds the additional check in loadImageListener. PR: https://github.com/appcelerator/titanium_mobile/pull/4711 3_1_X PR: https://github.com/appcelerator/titanium_mobile/pull/4712
  6. Olga Romero 2013-09-19

    Tested and verified the fix with: Appcelerator Studio, build: 3.1.3.201309132456 Titanium SDK, build: 3.1.3.GA CLI 3.1.2 Alloy 1.2.2 code-processor 1.0.3 Device: Nexus7 Android version:4.3 The image is shown

JSON Source