Drag and drop
Support for drag-and-drop ensures a great user experience using all the different input types supported by the Surface Duo.
This sample demonstrates how to implement drag-and drop in your Android app, following the Android drag and drop guidance.
Drag-and-drop lets a user easily share data between parts of an app, or between different apps on two screens.
Types of apps that may benefit from this pattern
- Apps that contain text or images.
For more info see the drag-and-drop section of Introduction to dual-screen devices.
Try our sample
Get the drag-and-drop sample on GitHub:
|C# (Xamarin):||Coming soon|
Source code overview
These snippets show the key steps for drag-and-drop.
Attach a dragListener to the view where you want to drop.
Implement ACTION_DROP in onDrag()
Grab URI from DragEvent
Request a permission to this URI
Make a query to ContentProvider to fetch the dropped item