K.Muthu K.Muthu - 2 years ago 93
Java Question

how to implement a long click listener and onclicklistener in single listview

I am creating a app in android. In that i am using list view. now i want use both click event and long click event. if is possible can any help me to do.

Answer Source

see this

Click & Long-Press Event Listeners in a ListActivity

lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    public void onItemClick(AdapterView<?> av, View v, int pos, long id) {


 lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
        public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
            return onLongListItemClick(v,pos,id);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download