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.
You just need to return true
list.setOnItemLongClickListener(new OnItemLongClickListener() {
    @Override
    public boolean onItemLongClick(final AdapterView<?> p, View v,final int po, long id) {
        // your code
    return true;
    }    
});
It basically tells the system that the Long press event has been handled (default is false), and no further events need to be handled (i.e. a single press, which inadvertently would happen in a long press event) 
see this
Click & Long-Press Event Listeners in a ListActivity
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> av, View v, int pos, long id) {
        onListItemClick(v,pos,id);
    }
});
..
 lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
            return onLongListItemClick(v,pos,id);
        }
    });
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With