I\'m trying to disable multiple click events on listview, say after pressing first click some media gets played from webservice, while it gets played, other items need to be
Make your own subclass of ArrayAdapter that has AreAllItemsEnabled() return false, and define isEnabled(int position) to return false for a given item in your the ones you want to disable.
before onCreate:
private long mLastClickTimeListViewItem = 0;
To prevent multiple clicks on ListView Items
After onCreate inside the listener for listView,in my case the following:
listView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (SystemClock.elapsedRealtime() - mLastClickTimeListViewItem < 1000){
return ;
}
mLastClickTimeListViewItem = SystemClock.elapsedRealtime();
//Do your remaining code magic below...
....
....
} // end of onItemClick method
}); // end of setOnItemClickListner
Add this to the xml
android:listSelector="@android:color/transparent"
Or in simple way to un-register and register OnItemClickListener can be a better idea.