I set @OnClick
listener to a view in a list item. In some cases I need to disable the listener for this view so that the list view can handle the click (OnItemClickListener should be called), and then enable it again. Is there a way to do this with Butterknife?
I've looked through the ButterKnife sources and it looks like BK generates and sets OnClickListener
s on views when you're using @OnClick(R.id.some_id)
annotation.
Now, the only way to disable OnClickListener
is to remove it:
item.setOnClickListener(null)
.
If you need it again, you can ask ButterKnife
to repeat the injection:
ButterKnife.inject(item);
That and the solution proposed by Ethan are the only solutions I can think of.