开发者

What's the difference between setOnClickListener() & setOnCheckedChangedListener() for checkbox?

What's the difference between setOnClickListener() & setOnCheckedChangedListener() for checkbox?

I am work开发者_如何学JAVAing with both listener but i could not find any difference,they both gives same answer.Please solve this query

thank you

regards

Ayudh


We use setOnClickListener() for Perform action on clicks, depending on whether it's now checked or not whereas setOnCheckedChangedListener() method used for checkbox change listener -- that is where we handle the changes in the checkbox state.


setOnClickListener() is a listener that can be used mostly with all kinds of view(widgets) for performing action on Click while setOnCheckedChangedListener() is used only to change the state of checkbox and radio buttons. You should prefer setOnCheckedChangedListener() for changing the state of checkbox and perform some action.


Google uses onClickListener in this tutorial, even when they manipulate widgets that support the change listener.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜