I have a EditText
. I've changed its default behaviour so I need to handle onTouchListener
and OnClickListener
at the same time.
The default system uses onTouchListener
for change the cursor position, so I captured it with this code:
var otl = OnTouchListener { v, event ->
when (event.action) {
MotionEvent.ACTION_DOWN -> {
editX = event.x
editY = event.y
Log.d("myMess","touch click") // debug in logcat
}
}
false
}
...
ed.setOnTouchListener(otl)
Notice that I return false
, so the click event should be fired after.
I've read all stuff in Stackoverflow including this
I just put the logcat displays after I've noticed the problem, so there is no influence for the time interval. I use elapsedRealtime
for measuring the intervals and printing in my logcat.
In another point I set:
ed.setOnClickListener(::clickS)
fun clicks(vi:View:){
if (vi==ed) {
Log.d("myMess","simple click") // debug in logcat
...
}
}
Until around 300ms, OnClickListener
don't fire, above this time it fires normally.
It's a big mistery. I have no hint for my problem.