Skip to main content

Posts

Showing posts from February, 2013

Drag n Drop in Android

"Drag and Drop" is one of the most cool UI interaction technique, but at the same time it appears to be a very complex implementation approach. This was my assumption (and I believe, many of you also think on the same line) before I looked into Android's "Drag n Drop" framework and API. It makes the whole implementation pretty straight forward as long as we understand the API components and its interaction. Here I'll explain important components to implement "Drag n Drop" UI in your application. Before starting the imple mentation , we need to de cide 4 important components- Drag Source , Drop Target , Data to transfer and Dr ag Gesture . Both source and destination can be any View and they can be part of 2 different Fragments/Activities "displayed on  the same Screen". Android provides a Parcelable class ClipData to hold data that you want to transfer from Source to Destination , it can hold any kind of data- te xt, UR I etc. Once