Disable onItemClickListener for an adapter?


I've two list one with custom adapter and other with array adapter. So i want onItemClickListener to work with custom adapter listview and it will automatically disable when I start using same listview for array adapter. To initiate array adapter list I'm using button. And using same listview for both adapters.

I've already try using ListView.setClickable(false) . but this doesn't work.

see you have to play with you onItemClickListener like as

lv.setOnItemClickListener(new OnItemClickListener() {
 public void onItemClick(AdapterView<?> arg0, View arg1, int position,
                long arg3) {

here you can set a Boolean flag whether you are accessing you list with custom adapter or from array adapter. and on the base of this flag you can you this listener