Android Developers
Published in

Android Developers

Simplifying drag and drop

At the most basic level, drag and drop is a gesture where a user can tap and hold an image, text string or other data element, then drag it into another app (or to another location in the same app) and release, where the data is incorporated in the new location. This gesture is usually a long press on touch screens or a click and drag when using a mouse.

A simple drag & drop sample.

While Android has long supported drag and drop (DragEvent was introduced in Android 3.0, API level 11), integrating full support for handling gestures, events, permissions and callbacks has proven to be complex.

Today we’re introducing the Jetpack DragAndDrop library as an alpha release to make it easier for you to handle data dropped into your app.

Drag and drop is becoming increasingly relevant for large screen form factors: tablet and laptops, but especially also foldables, where split screen is used 7 times as often than on conventional phones. The ability to drag data from one app to another is a natural experience for users as they multitask more efficiently with their apps in split-screen or windowed modes.

While dragging text from EditTexts is supported natively by the platform, we strongly recommend enabling users to drag any images, files or text from other components of your app. Just as importantly, we encourage allowing users to drop data into your apps as well.

Dragging from one app into another.

DropHelper, in combination with DragStartHelper, makes it much easier to take care of gesture support, callbacks, styling and pixel-perfect alignment.


DragStartHelper is a utility class in Jetpack core that detects gestures commonly used to start a drag, such as long pressing or click and dragging with a mouse.


The new DropHelper is a utility class that takes care of listeners and drop targets. Be sure to use addInnerEditTexts() when building DropHelper.Options to ensure that any nested EditTexts inside your drop target don’t acquire focus instead.

Learn more

Read more in the Drag and drop guide on Android Developers, dive into the sample to see DropHelper in practice and then try it out in alpha now to give us feedback.

Thanks to Florina, Ben and Nick!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Paul Lammertsma

Paul Lammertsma

Senior Developer Relations Engineer at Google