Search code examples
androidstylus-pen

Is it possible to make stylus operate only when finger is toucing it


i want to ask wheter there is a way to make stylus operate only when finger is touching it, so with my fingers of no changes to be made on screen, and when i do touch it, to work, i hope i was clear, sorry for my bad english. If this is not possible, is it possible to make android app that wil not hold(wait for my finger to go off) when i am constantly touchg the screen, what i am trying to say is if can operation be done as soon as i touch the screen no matter how much time i am holding it, i dont want app to wait for my finger to go off, best regards to everyone


Solution

  • I'm not entirely sure what you mean but here goes:

    Try adding a touchListener and then handle the onTouchEvent like this

    @Override
    public boolean onTouchEvent(MotionEvent event)
    {
        if (event.getAction() == MotionEvent.ACTION_DOWN)
        {
            ...add the code you want to execute...
            return true;
        }
        return false;
    }
    

    This way you handle the event as soon as your finger touches the screen