Long Press — What It Is, the Long Touch Gesture in Apps

Author: IT Sectr Published: 2026-02-27 Reading time: 8 min

Long Press is a long press gesture where the finger stays on the screen for a certain amount of time (usually 0.5–1 second) without moving. Unlike Tap, Long Press is recognized not at the moment of touch, but after the delay timer expires. The gesture is used to invoke a context menu, preview content, select multiple objects, and trigger additional actions. It is implemented on iOS via UILongPressGestureRecognizer, and on Android via setOnLongClickListener or GestureDetector.

Key Takeaways

  • Delay — the main difference between Long Press and Tap: requires holding for 0.5–1 second
  • Context Menu — the most common use of Long Press: invoking additional options for an element
  • UILongPressGestureRecognizer — the primary iOS class for handling long press with state callbacks
  • setOnLongClickListener — the Android View method that triggers a listener on long press
  • Multi-state — Long Press goes through began, changed, ended, cancelled states in iOS

What Is Long Press?

Long Press is a multi-touch interface gesture where the user touches the screen and holds the finger still for a specified duration. The system does not react instantly: it waits for a timeout (usually 500 ms), and only after it expires does it recognize the gesture as Long Press. If the finger is released sooner — the gesture is interpreted as a regular Tap.

The gesture is a fundamental building block of modern mobile interfaces. Apple uses it to invoke context menus in apps (Messages, Safari, Files). Google integrated Long Press into text selection, icon rearrangement on the home screen, and context menu invocation in Android. In web interfaces, long press often emulates a right mouse click on mobile devices, where there is no physical right button.

Historically, Long Press emerged as an alternative to the context menu (right click) for touch screens. Early implementations appeared on devices with resistive screens (Palm, Windows Mobile in the early 2000s), but the gesture became standardized only with the advent of iPhone and Android. Both platforms' Human Interface Guidelines describe Long Press as a secondary action — not a replacement for Tap, but an extension of functionality.

How Long Press Differs from Tap

Long Press and Tap are two different gestures with different semantics. Tap is an instant press: the finger touches the screen and is released within 100–300 ms. Tap is always a primary action: open an app, press a button, follow a link. Long Press is a secondary action: open a context menu, start editing, show additional information.

ParameterTapLong Press
Hold time100–300 ms500–1000 ms
Action typePrimarySecondary
ExamplesOpening a link, pressing a buttonContext menu, editing
FeedbackVisual (highlight)Haptic (Haptic Feedback)
iOS APIUITapGestureRecognizerUILongPressGestureRecognizer
Android APIsetOnClickListenersetOnLongClickListener

Key rule: never use Long Press as the only way to perform an action. Users expect Tap to perform the primary action, and Long Press to open additional options. Violating this principle (for example, requiring a long press to open a link) leads to a negative user experience and reduced accessibility.

Long Press in iOS: UILongPressGestureRecognizer

UILongPressGestureRecognizer is the standard gesture recognizer in the iOS SDK for handling long press. It inherits from UIGestureRecognizer and supports configuration of minimum duration, allowable finger movement, and number of touches. The recognizer transitions to UIGestureRecognizerStateBegan after the timer expires, then to UIGestureRecognizerStateChanged when the finger moves, and UIGestureRecognizerStateEnded upon release.

swift
// UILongPressGestureRecognizer with minimum duration configuration
class ContextMenuViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let longPressRecognizer = UILongPressGestureRecognizer(
            target: self,
            action: #selector(handleLongPress(_:))
        )

        // Minimum hold time: 0.5 seconds
        longPressRecognizer.minimumPressDuration = 0.5

        // Allowable finger movement: 10 points
        longPressRecognizer.allowableMovement = 10

        customView.addGestureRecognizer(longPressRecognizer)
    }

    @objc func handleLongPress(_ recognizer: UILongPressGestureRecognizer) {
        guard recognizer.state == .began else { return }

        // Creating a context menu
        let location = recognizer.location(in: self.view)
        ContextMenuPresenter.show(at: location)
    }
}

Configuration parameters: minimumPressDuration — time in seconds before activation (default 0.5, for accessibility 0.65+ is recommended); allowableMovement — maximum finger movement in points (default 10, increasing helps with unsteady hands). iOS supports numberOfTouchesRequired for multi-touch gestures (e.g., long press with two fingers). The recognizer also integrates with UIContextMenuInteraction — when a context menu is added to a UIView via UIContextMenuConfiguration, Long Press automatically invokes the context menu without manual gesture implementation.

Long Press in Android: setOnLongClickListener

setOnLongClickListener is a View method in the Android SDK that sets a long press listener. When a user holds a View for more than 500 ms, the system calls onLongClick(). The method returns a boolean — true means the event was handled and should not propagate further, false means the event can be handled by other listeners. For more complex handling (finger movement after Long Press starts), GestureDetector with OnGestureListener is used.

kotlin
// Example of setOnLongClickListener with haptic feedback
val itemView: View = findViewById(R.id.itemView)

itemView.setOnLongClickListener {
    // Haptic feedback to confirm gesture start
    it.performHapticFeedback(
        HapticFeedbackConstants.LONG_PRESS
    )

    // Showing context menu at element position
    val popup = PopupMenu(this, it)
    popup.menuInflater.inflate(R.menu.context_menu, popup.menu)
    popup.show()

    true // Event handled
}

GestureDetector provides finer control over the gesture. Unlike setOnLongClickListener, GestureDetector notifies about the start (onLongPress), movement (onScroll), and release. This enables complex scenarios — for example, starting a drag after a long press (Drag-and-Drop). OnGestureListener requires implementing six methods: onDown, onShowPress, onSingleTapUp, onScroll, onLongPress, onFling.

Where Long Press Is Used

Long Press is used in dozens of mobile interface scenarios. The most common application is the context menu: long press on a contact shows communication options (call, message, email), on a file — options (copy, move, delete), on text — selection and clipboard. The Android Launcher uses long press on an icon to move apps and add widgets.

Text selection is a classic example of Long Press on both platforms. In iOS, long pressing on text activates a magnifying glass for cursor positioning; on a word — selects it with handles. In Android, long press selects the entire word and shows an action bar (copy, cut, paste). Both platforms use subsequent handle dragging to expand the selection.

Preview — in iOS, long pressing a link in Safari or a message in Mail opens a content preview (peek). In Android, similar behavior is implemented via Long Press on a notification (expands the notification with action buttons). Photo apps use long press on a thumbnail for quick image preview.

Drag-and-Drop is often initiated by Long Press. The user holds the element, the system switches to drag mode, and finger movement moves the element across the screen. Android supports this scenario via View.startDragAndDrop() after Long Press. iOS uses UIDragInteraction, where drag interaction requires a long press to start dragging.

Best Practices for Using Long Press

Human Interface Guidelines of both platforms provide clear recommendations: Long Press should always be a secondary action. Never make long press the only way to perform a critical function. Users first try Tap — if Tap doesn't work as expected, they get frustrated. Add visual cues: context menus can be indicated by a three-dot icon, and elements supporting Long Press — by a visual hint on touch.

Haptic feedback is mandatory for Long Press. When the gesture is recognized, the device should confirm it with haptic feedback: in iOS this is UIImpactFeedbackGenerator with a light impulse, in Android — HapticFeedbackConstants.LONG_PRESS. Without haptic feedback, the user is not sure the gesture registered and may press again, causing unwanted actions.

RecommendationiOSAndroid
Recognition timeout0.5–0.65 seconds500 ms (default)
Haptic feedbackUIImpactFeedbackGeneratorHapticFeedbackConstants.LONG_PRESS
Visual feedbackContext menu, highlightPopupMenu, ripple animation
AccessibilityVoiceOver + Custom ActionsTalkBack + AccessibilityNodeInfo
Max finger movementallowableMovement = 10 ptTouchSlop (default ~8 dp)
Scroll conflictcancelsTouchesInView = delayedonInterceptTouchEvent + LongPress

Accessibility: not all users can perform a long press (people with motor impairments, elderly users). Always provide an alternative way to access Long Press actions — for example, via a "More" button in the interface or through system accessibility features (VoiceOver on iOS, TalkBack on Android). For iOS, you can add Custom Actions via UIAccessibilityCustomAction, which are available through the VoiceOver rotor.

Frequently Asked Questions

What is the standard hold time for Long Press?

The standard time for Long Press is 0.5 seconds (500 ms) on both platforms. iOS allows configuring minimumPressDuration from 0.3 to 1.0 seconds. Android uses a fixed timeout of 500 ms for View.setOnLongClickListener. For users with limited motor skills, it is recommended to increase the timeout to 0.8–1.0 seconds.

What is the difference between Long Press and 3D Touch?

Long Press is recognized by hold time (0.5 s), 3D Touch — by pressure (grams of force). 3D Touch is only available on iPhone 6S–XR (hardware Force Touch technology). Starting with iOS 13, Apple replaced 3D Touch with Haptic Touch — a software simulation that works via Long Press with haptic feedback. Haptic Touch is available on all modern iPhones and iPads.

How to avoid Long Press conflict with ScrollView scrolling?

The Long Press and scroll conflict is a common issue. Solution: set delaysTouchesBegan = true for the gesture recognizer in iOS (the system does not send touchesBegan immediately, but waits for gesture recognition). In Android, use onInterceptTouchEvent returning false for Long Press. If the user starts moving the finger before the timeout — the gesture is canceled in favor of scrolling.

Can Long Press be used in web applications (PWA)?

Yes, Long Press is supported in web applications via the touchstart/touchend event with time measurement. Modern browsers also support the contextmenu event, which fires on long press on mobile devices. For cross-browser compatibility, use libraries like hammer.js or implement a custom recognizer via setInterval in the touchstart handler.

How to add haptic feedback for Long Press on iOS?

In iOS, haptic feedback is added via UIImpactFeedbackGenerator. Call impactOccurred() when UILongPressGestureRecognizer transitions to the began state. For a light response, use UIImpactFeedbackGenerator(style: .light). For a more noticeable one — .medium. For context menus, iOS automatically adds haptic feedback via UIContextMenuInteraction without additional code.

Summary

  • Long Press — a finger hold gesture on the screen for 0.5–1 second to invoke secondary actions
  • Difference from Tap — Tap is instantaneous (primary action), Long Press requires a timeout (secondary action)
  • iOS API — UILongPressGestureRecognizer with minimumPressDuration and allowableMovement parameters
  • Android API — View.setOnLongClickListener and GestureDetector.OnGestureListener
  • Uses — context menus, text selection, preview, initiating Drag-and-Drop
  • Haptic feedback — mandatory to confirm gesture recognition to the user
  • Accessibility — always provide alternative access to Long Press actions

We will develop a mobile application turnkey

IT Sectr creates iOS and Android applications for startups and businesses since 2017. We will advise you and propose the best solution.

Discuss the project

Read also