Вопрос

So I have an EditText view, what I want to do is execute some code if the user touches the EditText view but execute another code if the user does a long touch/click, the problem I'm facing is that onTouch is always executed first before onLongClick, is there anyway to detect that if the user long presses to only execute that code and not the code in onTouch ?

Это было полезно?

Решение

For getting things done you have to use onClickListener instead of onTouchListener. This time different dialogs will be opened. It works because long click and click are the same level (defined) actions while touch could be any action user performs (click, long click, focus changing, etc).

Inspect UI. Event Listeners for information in advance.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top