OnTouch/OnClick listeners. Use both?
I have a short question. Should I use in same time OnTouch and OnClick listeners ? If I`m correct one is for touch screens and other开发者_StackOverflow中文版 is for devices with out it. Am I wrong ? If not should I use both listeners to secure both kind of devices ?
You only need OnTouch
if you have some event that should only happen with a touch screen. If you just want to do something when the user taps (or clicks), then you only need OnClick
.
I use both. I've create a class extending from Button class. I've put my custom appearance and interaction (programmaticaly) on the onTouch() method and the functionality for the onClick().
精彩评论