Simone,

If the purpose of handling long-clicks is to display a context menu for list items, you can use this:

yourActivity.registerForContextMenu(yourListViewReference)

If it's actually the long click you want, you can set a listener for it:

yourListViewReference.setOnItemLongClickListener(<listener class here, as usual>)

Neither requires subclassing the list view.

-- Kostya

16.10.2010 13:12, Kumar Bibek ?????:
When you long click on a list item, the method onItemLongClick should be called. If you want your own listener, you cannot do that on the stock listview. Extend and create your own list view and configure a separate lintener for that.

On Sat, Oct 16, 2010 at 2:39 PM, Simone <simone.russ...@gmail.com <mailto:simone.russ...@gmail.com>> wrote:

    I'll be brief. I have a ListActivity that uses a custom Adapter
    implementing BaseAdapter.
    When I perform a click on an object, the method
    ListActivity.onListItemClick() gets executed.
    Is there a way to execute a different portion of code when I perform a
    LONG click on an item?
    Thanks,
    Simone

    --
    You received this message because you are subscribed to the Google
    Groups "Android Developers" group.
    To post to this group, send email to
    android-developers@googlegroups.com
    <mailto:android-developers@googlegroups.com>
    To unsubscribe from this group, send email to
    android-developers+unsubscr...@googlegroups.com
    <mailto:android-developers%2bunsubscr...@googlegroups.com>
    For more options, visit this group at
    http://groups.google.com/group/android-developers?hl=en




--
Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to