public static int dragViewTo(View v,int gravity,int toX,int toY){
  int[] xy=new int[2];
  getStartLocation(v,gravity,xy);
  int fromX=xy[0];
  int fromY=xy[1];
  int deltaX=fromX - toX;
  int deltaY=fromY - toY;
  int distance=(int)Math.sqrt(deltaX * deltaX + deltaY * deltaY);
  drag(fromX,toX,fromY,toY,distance);
  return distance;
}

public static int dragViewTo ( View v , int gravity , int toX , int toY ) { int [ ] xy = new int [ 2 ] ; getStartLocation ( v , gravity , xy ) ; int fromX = xy [ 0 ] ; int fromY = xy [ 1 ] ; int deltaX = fromX - toX ; int deltaY = fromY - toY ; int distance = ( int ) Math . sqrt ( deltaX * deltaX + deltaY * deltaY ) ; drag ( fromX , toX , fromY , toY , distance ) ; return distance ; }
simulate touching a view and dragging it to a specified location .
