Redeem Now
Read More
Read now

How we can use Drag and Drop in Android

Save

In this blog we will read how we can use Drag and Drop  in Android . Drag and Drop  allows user to move your data from one view to another.

Drag And Drop process

In Drag and Drop process there are four steps

1.Started

2.Continuing

3.Dropped

4.Ended

1.Started

This step occurred when the user starts dragging into view. when the user starts dragging then startDrag() method will call .

2.Continuing

This step occurs when user continues to drag and shadow intersect on view and ACTION_DRAG_ENTERED event will call

3.Dropped

user can drop view anywhere on the screen . But the thing to be noted here is that you can drop the dragged element in any part of the screen but the dropped event will be called only when if you drop the view in a view that is associated with the drag event and ACTION_DROP event will call

4.Ended

when user drops shadow anywhere and then this event will occur and ACTION_DRAG_ENDED event will call

Now let’s start code for it.

 

MainActivity

activity_main

Now you can see in the screenshot how we drag car from one dimension to another

dragAndDrop
dragAndDrop

So here we discussed about How we can use Drag and Drop in Android.  Thanks for reading this blog and You can get other blogs from here

. . .

Comment

Add Your Comment

Be the first to comment.

css.php
Hire Us!
Brief us about your requirements and we'll get back to you.
Woo! Hooy!
We have just recieved your project brief and our expert will contact you shortly.
Send Again
Close