0

I have listview in RelativeLayout. I want to listen for left/right swipes and single/long clicks. For listen swipes I use instance of SimpleOnGestureListener, which I return in -

listView.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return gestureDetector.onTouchEvent(event);
            }
        });

In this case I cant listen for long clicks because SimpleOnGestureListener's method - onLongPress returns void. Is there way to listen for long click exactly in listview's OnItemLongClickListener method and also listen swipes? Thanks.

bene25
  • 580
  • 6
  • 18

2 Answers2

0
lv.setOnItemLongClickListener(new OnItemLongClickListener() {
            @Override
            public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
                    int pos, long id) {
                // TODO Auto-generated method stub



                return true;
            }
        }); 
Sohail Zahid
  • 8,099
  • 2
  • 25
  • 41
0

I've changed ListView to RecyclerView like Burhanuddin Rashid suggested

Community
  • 1
  • 1
bene25
  • 580
  • 6
  • 18