ImageView imageView = findViewById(R.id.imageView); imageView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { // Custom touch logic here return true; } });In this example, we are setting a touch listener on an image view with the id `imageView`. The touch listener is implemented as an anonymous class that overrides the `onTouch` method. We can add custom touch logic inside this method and return `true` to indicate that the touch event has been consumed and should not be passed on to the next listener. Package library: android.widget