Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-14777

Android: NullPointerException on ListView + ImageView

    Details

      Description

      Application would sometimes crash (NPE) when aggressively scrolling a ListView with remote images.

      Seems there were some safety checks missing in the code (although they were used elsewhere in the same class). Added the safety checks as needed.

      Testing code:

      var section = Ti.UI.createListSection({footerTitle: "Footer 1"});
       
      var data = [];
      for (var i = 0; i < 40; i++) {
       
          var builtInRow = {
          	properties: {
          	height: '150dp',
      		title: "Label " + i, 
      		image: null,
      		accessoryType: 3
      		} 
      	};
      	
      	if (i == 5) {
      	    builtInRow.properties.image = 'https://g.twimg.com/business/page/image/11TwitterForSmallBusiness-300_1.png';
      	} else if (i == 10) {
      	   builtInRow.properties.image = 'http://static.appcelerator.com/images/header/appc_logo.png';
      	} else if (i == 15) {
      	   builtInRow.properties.image = 'http://www.seobook.com/images/smallfish.jpg';
      	} else if (i == 20) {
      	   builtInRow.properties.image = 'http://www.newyorker.com/online/blogs/photobooth/NASAEarth-01.jpg';
      	} else if (i == 25) {
      	   builtInRow.properties.image = 'http://www.wallcg.com/images/2013/02/nature-fond-ecran-image-arriere-plan-hd-29-hd.jpg';
      	}
      	data.push(builtInRow);
      	
      }
      section.setItems(data);
       
       
      var listView = Ti.UI.createListView({backgroundColor: "white", sections: [section]});
       
      var win = Ti.UI.createWindow({fullscreen: false, backgroundColor: 'red'});
       
      win.add(listView);
       
      win.open();
      

      1. Run code
      2. Scroll aggressively. App should not crash.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hpham Hieu Pham
                Reporter:
                dleshem Danny Leshem
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-17158
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration