What do I need?

I need to run the showToast("Yes"); code showToast("Yes"); after two seconds of holding the point on the graph pressed. Preferably, not letting go

What I can?

I can track the click on the dot.

 public void onValueSelected(int lineIndex, int pointIndex, PointValue value) {} 

Release point

 public void onValueDeselected() {} 

    1 answer 1

    Take the current time of the new Date (System.currentTimeMillis ()) when pressed and when released and subtract the first from the second. Here you have a retention time.

    • It is possible and so, but it would be desirable for me to execute this code without releasing the dot. You may have encountered this in some applications - while holding an object for a certain time, the phone vibrates a bit and we can, for example, move the object while holding it. - Mr Klonwar
    • @MrKlonwar To achieve this effect, you need Drag and Drop. vogella.com/tutorials/AndroidDragAndDrop/article.html - Eugene Troyanskii