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

Android: 'longpress' on tableView with headerView but no headerTitle returns incorrect index and might lead to a crash

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Low
    • Resolution: Duplicate
    • Affects Version/s: Release 3.2.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      I've already added a comment on TIMOB-12114 but I do not have the permission to reopen it because it is already resolved.

      The app is still crashing on 3.2.0.v20130522115134 build if you remove the headerTitle. Tried it on a Samsung Galaxy S2 with Android 4.1.2.

      Looks like it is crashing even if you haven't added a longpress event listener. That means once a user does a longpress on any row, the Android app crashes.

      Link to Q&A discussion: http://developer.appcelerator.com/question/152977/android-longpress-on-tableview-with-headerview-returns-incorrect-index-and-might-lead-to-a-crash

      Code to reproduce:

      var _self = Ti.UI.createWindow({
      	backgroundColor : '#fff',
      	height : Ti.UI.FILL,
      	width : Ti.UI.FILL
      });
      _self.open();
       
      var table = Ti.UI.createTableView({
      	//headerTitle : "title" // Remove to fix
      });
       
      var headerView = Ti.UI.createView({
      	backgroundColor : '#444',
      	visible : false,
      	height : 0
      });
      var titleLabel = Ti.UI.createLabel({
      	width : _self.width,
      	textAlign : 'center',
      	color : '#eee',
      	text : "Title text"
      });
      headerView.add(titleLabel);
      table.setHeaderView(headerView);
       
      var row = Ti.UI.createTableViewRow({
      	title : 'Press me long'
      });
      table.setData([row]);
       
      _self.add(table);
       
      table.addEventListener('click', function(e) {
      	Ti.API.info("#### table - row " + e.index + " clicked")
      });
      table.addEventListener('longpress', function(e) {
      	Ti.API.info("#### table - row " + e.index + " longpressed")
      });
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ingo Ingo Muschenetz
                Reporter:
                jicks83 Jick Steen
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code