Rafi Ginat
Rafi Ginat

Reputation: 40

setOnItemLongClickListener not receiving events

I've got this problem that I cannot receive this event, something is blocking it from one of my items in the listView but I don't know what, I checked focus on the item set to false and it not worked. Also check setting the item to be onlongclickable but it didn't work also. What more?

Upvotes: 1

Views: 240

Answers (2)

Rajesh Mikkilineni
Rajesh Mikkilineni

Reputation: 844

you can do something like this in your ListView Adapter ,getView() ,

 // For onlongclicks

    final View deleteView  = convertView;

    deleteView.setOnLongClickListener(new OnLongClickListener() {

        @Override
        public boolean onLongClick(final View v) {
            // TODO Auto-generated method stub

        }
    });

//For Just onClick

 deleteView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
      }
    });

Upvotes: 0

David Bemerguy
David Bemerguy

Reputation: 1364

I had a problem with that and set the parent of the layout android:descendantFocusability="blocksDescendants", this is the list view item layout

Upvotes: 1

Related Questions