Exploring Drag and Drop

In this next example application, we’re going to take a white dot and drag it to a new location in our user interface. We’re also going to place three counters in our user interface, and if the user drags the white dot to one of the counters, that counter will increment and the dot will return back to its starting place. If the dot is dragged somewhere else on the screen, we’ll just leave it there.

NOTE: See the “References” section at the end of this chapter for the URL from which you can import these projects into Eclipse directly. We’ll only show code in the text to explain concepts. You’ll need to download the code to create a working example application.

The first sample application for this chapter is called TouchDragDemo. ...

Get Pro Android 4 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.