blackjack
blackjack

Reputation: 585

In gridview how to swap images with drag and drop event

i am new to android and now want to implement the drag and drop.i m having the gridview holding image and need to swap image through drag and drop operation.somehow able to do the drag of the image so,now how can the drag object can be placed in other image(object) place and the second image being replaced take the place of drag image.

If code require please let me know.

any reply will be very helpfull.

Upvotes: 0

Views: 2744

Answers (3)

QVDev
QVDev

Reputation: 1093

Start step by step, like first implement drag and drop and then the swap functionality. For drag and drop have a look at the developers website from Android: http://developer.android.com/guide/topics/ui/drag-drop.html

Then when you have that working you can think of logic for swapping. For example

  • Start dragging remember current location, or ImageView.
  • When releasing drop action, see what ImageView is underneath the touch location.
  • Attach image drag to drop ImageView and attach image swap to drag imageview

Upvotes: 1

Barney
Barney

Reputation: 2373

You can find many solutions by googling 'android gridview drap drop'. Here's some examples:

Upvotes: 0

Related Questions