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 <[email protected]> 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 [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Kumar Bibek http://techdroid.kbeanie.com http://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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

