Thursday, October 14, 2010

[android-developers] Re: touch vs. drag

You have to catch the ACTION_DOWN to get a copy of the widget you
touched using "getDrawingCache", and catch the ACTION_MOVE to set new
location for the layout which holds the the drawing copy you already
got from the ACTION_DOWN.


On Oct 13, 8:26 pm, Kumar Bibek <coomar....@gmail.com> wrote:
> Hope this gives you an idea.http://techdroid.kbeanie.com/2010/04/simple-drag-n-drop-on-android.html
>
>
>
> On Tue, Oct 12, 2010 at 2:40 PM, Waleed Oransa <wora...@gmail.com> wrote:
> > Hello all,
>
> > I need your help in differentiate between touch event and drag .. since I
> > need to do action when user touch the screen and another action when it
> > touch and drag .. I wrote the code below but it only works for touch but not
> > for drag. ret is the return value of the onTouch method.
>
> > I appreciate if you can help or provide a code example. Thanks
> > Waleed
>
> > switch (eventaction ) {
> > case MotionEvent.ACTION_MOVE:
> >  moveTouch = true;
> > ret=false;
> > break;
> >  case MotionEvent.ACTION_DOWN:
> > startTouch = true;
> > ret=false;
> >  break;
> > case MotionEvent.ACTION_UP:
> > if (startTouch== true && moveTouch == false)
> >  {
> > // Do action associated with touch
> > ret= true;
> >  moveTouch = false;
> > startTouch= false;
> > }
> >  else if (startTouch= true && moveTouch == true)
> > {
> > // Do action associated with drag
>
> >   ret= true;
> >    moveTouch = false;
> >            startTouch= false;
> >  }
>
> > break;
> > }
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscribe@googlegroups.com<android-developers%2Bunsubscribe@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate