Skip to content Skip to sidebar Skip to footer

In Android Is There Any Way To Identify Touch Happened On A Button Or Checking Buttons Available In The Screen

I am trying to capture user touch events(for now basically I am focusing only the button clicks) from the screen. Following are the 2 approach I followed. Approach 1: Using overlay

Solution 1:

I am not sure what you are trying to do, but you can just listen for touch events on a button by:

myButton.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        return false;
    }
 });

Post a Comment for "In Android Is There Any Way To Identify Touch Happened On A Button Or Checking Buttons Available In The Screen"