Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10342] Android: Image view in a table view row can not be dynamically changed more than once.

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionDuplicate
Resolution Date2013-01-17T13:23:26.000+0000
Affected Version/sRelease 2.1.0, Release 2.1.1
Fix Version/sn/a
ComponentsAndroid
Labelsapi
ReporterSurajit Biswas
AssigneeIngo Muschenetz
Created2012-08-06T00:33:23.000+0000
Updated2017-03-21T22:41:42.000+0000

Description

I have a table view with more than one row. Each row contains one image and one label. My requirement is on click on the image of a particular row, that image need to change. In iPhone it is working fine but in android after the second click image is not changing. I have attached one sample code here.

Attachments

FileDateSize
SampleTableView 2.zip2012-08-06T00:33:23.000+0000826478

Comments

  1. Betty Tran 2012-08-08

    Problem

    Image views inside table rows do not change after the first time when we toggle between two images. For example, when we open the app, image 1 is loaded in the image view. We click on the image view and the image changes to image 2. Click on the image view again and it does not change to image 1. The value in e.source.image however, contains the path to the correct image each time.

    Steps to reproduce

    1. Click on image view (the image changes) 2. Click on image view (the image does not change)

    Code to reproduce

       
       var win = Ti.UI.createWindow();
       win.open();
       
       var aTableView = Ti.UI.createTableView();
       
       var row = Ti.UI.createTableViewRow({
       	height: Ti.UI.SIZE,
       	width: Ti.UI.FILL
       });
       
       
       var anImageView = Ti.UI.createImageView({
       	image : 'test.png',
       	width : 200,
       	height : 200,
       	top : 5,
       	left : 5
       });
       
       var imgStatus = 0;
       
       anImageView.addEventListener('click', function(e){
       	
       	if(imgStatus == 0) {
       		e.source.image = 'test2.png';
       		imgStatus = 1;
       	} else {
       		e.source.image = 'test.png';
       		imgStatus = 0;
       	}
       	
       	alert(e.source.image);
       });
       
       row.add(anImageView);
       
       aTableView.setData([row]);
       win.add(aTableView);
       

    Expected result

    Image view toggles between images correctly

    Actual result

    Image does not change after the first click
  2. heenok 2012-11-05

    Hello, I have the same problem here ! Any update ? Thanks !
  3. Anand T 2012-11-15

    Hi, I'm also having the same issue. Any updates available on this issue?
  4. Vinh Bach 2012-12-14

    I got this problem too, when will the Titanium team fix it?
  5. Ricardo Pinho 2013-01-17

    The workaround for this bug prevents a clean programming. The Titanium framework to keep its followers shouldn't wait all this time for solving this type of unacceptable bugs on an User Experience framework.
  6. Vishal Duggal 2013-01-17

    Dupe of TIMOB-11762 which is already fixed in master and will soon be back ported to 3_0_X for 3.0.2
  7. Lee Morris 2017-03-21

    Closing ticket as duplicate with reference to the above comments.

JSON Source