views:

674

answers:

2

I have a list of records in a listview that I want the user to be able to re-sort using a drag and drop method. I have seen this implemented in other apps, but I have not found a tutorial for it. It must be something that others need as well. Can anyone point me to some code for doing this?

+7  A: 

You're in luck -- I just released some code for this earlier today. It is based off of the drag-and-drop stuff used by the Music app for playlists.

CommonsWare
@Mark: Thank you very much!
Samuh
@Commonsware: in which music app is that been used? The standard Android one? I'm looking for the same right now and wanted to see it in action first. But I cannot find anything to drag in the playlist of the default music app as on the Nexus One for example. Long-press only opens the context menu.Thanks!
Mathias Lin
@Mathias Lin: Yes, that code is from the standard AOSP music app. Search the source code for `TouchDelegate`.
CommonsWare
@CommonsWare: yes, I found the code already, thanks. But where I can see it in action in the music app? Or is it not in 2.x anymore?
Mathias Lin
Ok, just found it on my G1 1.6... didn't see it on the N1 for podcast playlists (where I looked into first only), for music playlists it's there.. seeing it now :) thanks
Mathias Lin
A: 

It may also be helpful to reference my simple Drag and Drop list. You can find it here

ericharlow