Best Approach For Drag And Drop Between Views?

Problems with Canvas, OpenGL, etc...

Best Approach For Drag And Drop Between Views?

Postby JimBadger » Tue Nov 30, 2010 11:51 am

Hi,

I am creating an app where you will be able to drag clothing items from the right-hand side of the screen (custom SurfaceView 1) onto a human figure on the left-hand side of the screen (custom SurfaceView 2)

I've made great progress in drawing the images where I want them initially, in each view and I've got the dragging functionality sorted...within each view

Where I am stuck is that I can't drag an image out of it's parent view, because obviously it goes outside the Canvas bounds.

The two views are extensions of SurfaceView and are in their own RelativeLayouts inside a top-level RelativeLayout.

My layout is:

Code: Select all
<RelativeLayout>
    <TextView/>
    <RelativeLayout>
        <dynamically added custom SurfaceView1>
    </RelativeLayout>
    <RelativeLayout>
        <dynamically added custom SurfaceView2>
    </RelativeLayout>
    <Button> //six buttons
</RelativeLayout>

What I need to know is can I draw otuside the Canvas of a SurfaceView, or, what other possible approaches are there to the functionality I describe? Can the Canvas of my custome SurfaceView 1 be expanded to the full size of the screen, or somehow incorporate the Canvas of custome SurfaceView 2? There are other TextView and Button items on the screen that I don't want to draw over, which complicates matters further. (I do want the dragged clothing items to quite happily pass over the top of other screen elements, however...naturalyl).

I'm an absolute Android beginner and was really proud of how far I'd got by myself...until I tried dragging an image out of one of my custom SurfaceViews and it vanished...then the scale of my problem sank in.

I hope some of the experts here see this badly described and rambling problem as a challenge? :)
JimBadger
Freshman
Freshman
 
Posts: 7
Joined: Fri Jul 16, 2010 11:56 pm

Top

Re: Best Approach For Drag And Drop Between Views?

Postby JimBadger » Tue Nov 30, 2010 12:21 pm

Ooh, an idea occurs. I can't ry this out till I get home, but maybe one f you can tell me if it's stupid or not.

I have a thread that does the drawing to custom SurfaceView1's Canvas. So, once the dragged clothing item reaches the edge of SurfaceView1's Canvas, can I then pass the bitmap in question to the Canvas of custome SurfaceView2 and have the thread start using that Canvas for the remainder of the MotionEvent?

Erm, the "how" part of the above eludes me currently, of course.

Ack, I'm so stuck. I've got all this pent-up Android excitement and I can't express it in code because I don't know how. :) Quite funny really: "Must. Create. Something! Don't. Know....How!" ;)
JimBadger
Freshman
Freshman
 
Posts: 7
Joined: Fri Jul 16, 2010 11:56 pm

Re: Best Approach For Drag And Drop Between Views?

Postby I_Artist » Tue Nov 30, 2010 6:43 pm

Hi Jim,

I notice that you are online right now...

I have the same problem, did you find an answer?

-I_Artist
The I_Artist

follow me on Twitter: @I_Artist
follow Android Development on Twitter: #androiddev

Show the world that you are an #androiddev, wear the badge http://www.twibbon.com/join/androiddev
User avatar
I_Artist
Developer
Developer
 
Posts: 33
Joined: Fri Oct 16, 2009 3:49 am
Location: St-Eustache, Quebec

Re: Best Approach For Drag And Drop Between Views?

Postby JimBadger » Tue Nov 30, 2010 8:01 pm

Not yet, no. But it's not been a huge amount of time since I asked, so I'm not getting antsy.

I'm sure some clever bod will get around to me in their own good time.

Am going to try other things in the meantime. I might even be able to make do with just one SurfaceView, after all.

Regardless, I'd absolutely love to know how to do what I am trying to do, as it's doing my nut in.
JimBadger
Freshman
Freshman
 
Posts: 7
Joined: Fri Jul 16, 2010 11:56 pm

Re: Best Approach For Drag And Drop Between Views?

Postby I_Artist » Wed Dec 01, 2010 2:39 am

Hey Jim,

Thanks for answering. I haven't found anything either...

I hope we find something soon :)

-I_Artist
The I_Artist

follow me on Twitter: @I_Artist
follow Android Development on Twitter: #androiddev

Show the world that you are an #androiddev, wear the badge http://www.twibbon.com/join/androiddev
User avatar
I_Artist
Developer
Developer
 
Posts: 33
Joined: Fri Oct 16, 2009 3:49 am
Location: St-Eustache, Quebec

Re: Best Approach For Drag And Drop Between Views?

Postby JimBadger » Thu Dec 02, 2010 10:29 am

Sorry chaps, does my question not make any sense or something?
JimBadger
Freshman
Freshman
 
Posts: 7
Joined: Fri Jul 16, 2010 11:56 pm

Top

Re: Best Approach For Drag And Drop Between Views?

Postby mmoshaya » Fri Mar 25, 2011 2:02 pm

Hi,

I have just read your post and can understand what you're trying to do. Shame no one on here got back to you. Did you manage to find a solution?
mmoshaya
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Mar 25, 2011 1:58 pm

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 3 guests