Lukap
Lukap

Reputation: 31963

Drag and drop in preferences (reordering of items)

I have few items like this

<ListPreference android:key="key1"
    android:title="@string/title"
    android:entries="@array/asd"
    android:entryValues="@array/asd1"
    android:defaultValue="109" android:dialogTitle="title"
    android:negativeButtonText="@string/cancel" />
<ListPreference android:key="key2"
    android:title="@string/title2"
    android:entries="@array/asd2"
    android:entryValues="@array/asd22"
    android:defaultValue="109" android:dialogTitle="title"
    android:negativeButtonText="@string/cancel" />

and they are all placed in one category . . ., the thing I want to do is to be able to reorder the items ( to put key2 before key1 with drag and drop)

is this possible at all in android and how can I do this ?, what methods should I override ?

After dragging the second item and doping above the first the items should be swapped.

Upvotes: 3

Views: 1389

Answers (1)

Nishant Shah
Nishant Shah

Reputation: 3442

Go through this example

It helps me a lot.

Upvotes: 0

Related Questions