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

Android: Listview with template causes a nullpointer on itemclick

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 7.5.0
    • Component/s: Android
    • Labels:
    • Environment:

      Titanium SDK version: 7.4.0
      Platform & version: >= Android 4.4
      Device Details: Android emulator and physical (Moto G 2, Moto G5S, Zenfone 3)
      Host Operating System: OS 10.13.6 and Windows 10

    • Story Points:
      1
    • Sprint:
      2016 Sprint 17 SDK, 2018 Sprint 18 SDK

      Description

      When you click on a listitem, using a Listview with template, it causes a nullpointer.
      It happens when you try to manipulate the items of a section.

      Test case:

      index.xml

      <Alloy>
          <Window id="win">
              <ListView id="listView" backgroundColor="#fff">
                  <Templates>
                      <ItemTemplate name="menuItem">
                          <View bindId="item" height="50" backgroundColor="#24292e" color="#fff" onClick="onMenuItemClick">
                              <Label bindId="name" color="#fff"></Label>
                          </View>
                      </ItemTemplate>
                  </Templates>
                  <ListSection />
              </ListView>
          </Window>
      </Alloy>
      

      -------------------

      index.js

      function onMenuItemClick(e) {
          $.listView.sections[0].items = [];
      }
       
      var menuItems = [];
       
      menuItems.push({
          name: {
              text: "A"
          },
          template: 'menuItem'
      }, {
          name: {
              text: 'B'
          },
          template: 'menuItem'
      }, {
          name: {
              text: "C"
          },
          template: 'menuItem'
      }, {
          name: {
              text: "D"
          },
          template: 'menuItem'
      });
       
      $.listView.sections[0].items = menuItems;
       
      $.win.open();
      

        Attachments

          Activity

            People

            • Assignee:
              gmathews Gary Mathews
              Reporter:
              zaedyjava Zaedy Dantas Sayão
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Source Code