Adding longpointer press to a list

58 views
Skip to first unread message

Mario Barón

unread,
Oct 7, 2013, 11:56:35 AM10/7/13
to codenameone...@googlegroups.com
Hey guys, 

Can you please help me with adding a longpointerpress to a list? I need it to be able to react both to just a press and press and hold type of events. So far I have the following:

List listaVehiculos = List(MyListCellRenderer) {
     
     
@Override
     
public void longPointerPress(int x, int y) {
       
super.longPointerPress(x, y);
//Do something
}
@Override
      public void pointerPressed(int x, int y) {
        // TODO Auto-generated method stub
        super.pointerPressed(x, y);
//Do something else
}
}

The code as it is, responds only to the pointerPressed event but doesn't give any time for the longPointerPressed. I tried adding an ActionListener to the list but for some reason it didn't work. 

Thanks a lot for your help.

Shai Almog

unread,
Oct 7, 2013, 2:39:49 PM10/7/13
to codenameone...@googlegroups.com
Hi,
use a standard action listener and check evt.isLongEvent();

Mario Barón

unread,
Oct 8, 2013, 3:48:54 PM10/8/13
to codenameone...@googlegroups.com
Hey Shai, 

thanks a lot, that worked perfectly.
Reply all
Reply to author
Forward
0 new messages