Remove an onclick listener

2019-01-13 01:38发布

I have an object where the text cycles and displays status messages. When the messages change, I want the click event of the object to change to take you to the activity that the message is relating to.

So, I have a TextView mTitleView and I'm assigning the event like this.

public void setOnTitleClickListener(OnClickListener listener) {
    mTitleView.setOnClickListener(listener);
}

How do I remove that click event? There are some status messages that do not have an actionable area so I'd like to turn off the click event. I'd also like to be able to cycle through these click events and dispose of them properly, but I'm unsure of the best practice.

7条回答
【Aperson】
2楼-- · 2019-01-13 02:40

Just put,it has worked for me

itemView.setOnClickListener(null);
查看更多
登录 后发表回答