views:

120

answers:

1

Hi,

I have a list of items that are displayed using a ListView from a SQLCursor. The SQL table includes(as well as other things) a _id field and an order field. I use the order field to sort the list before it gets to the ListView.

What I need is a widget like the MediaPlayer has in its playlist view. It allows you to click the icon and drag the item in the playlist around and put it into a new order. With that ability I can then retrieve the new order and update the SQL table with the new order. However, I am not having any luck finding any clues to help me add that functionality into my program.

The question is whether I can use existing functions to help me, or do I need to manually program motion events and such until I get nearly the same functionality.

A: 

However, I am not having any luck finding any clues to help me add that functionality into my program.

If you want the functionality from the Music application (which, by the way, is not named "MediaPlayer"), go look at its source code. Here is a StackOverflow question with answers that point you to the specific class (TouchInterceptor) that enables the drag-and-drop.

The question is whether I can use existing functions to help me, or do I need to manually program motion events and such until I get nearly the same functionality.

If you are looking for a widget with built-in drag-and-drop, there is none in the SDK.

CommonsWare
well alrighty. That answers all my questions! annoying that I couldn't find that question you referred to in stack overflow myself. Hopefully I can figure out how to use that TouchInterceptor properly and really get my program rolling! Thanks.
CrazyBS
I haven't played with `TouchInterceptor`, so I do not know how reusable it is. I get the impression -- such as from that other SO question -- that others are successfully using it. Cleaning it up into a separate reusable widget is on my list of 18,000 things to do...
CommonsWare