You should use a for loop. Then specify the number counter in the list and check each count. Check if the cycle IDs are the same, if they are different, you will directly receive different images in the saved location.
public boolean onTouchEvent(MotionEvent ev) { // TODO Auto-generated method stub final int action = ev.getAction(); final int x = (int) ev.getX(); final int y = (int) ev.getY(); if (action == MotionEvent.ACTION_DOWN && x < this.getWidth()/4) { mDragMode = true; } if (!mDragMode) return super.onTouchEvent(ev); switch (action) { case MotionEvent.ACTION_DOWN: mStartPosition = pointToPosition(x,y); if (mStartPosition != INVALID_POSITION) { int mItemPosition = mStartPosition - getFirstVisiblePosition(); mDragPointOffset = y - getChildAt(mItemPosition).getTop(); mDragPointOffset -= ((int)ev.getRawY()) - y; startDrag(mItemPosition,y); drag(0,y);// replace 0 with x if desired } break; case MotionEvent.ACTION_MOVE: drag(0,y);// replace 0 with x if desired break; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: default: mDragMode = false; mEndPosition = pointToPosition(x,y); stopDrag(mStartPosition - getFirstVisiblePosition()); if (mDropListener != null && mStartPosition != INVALID_POSITION && mEndPosition != INVALID_POSITION) mDropListener.onDrop(mStartPosition, mEndPosition); break; } return true; }
this will help you embed code from one place to another. And in the Drag method, specify x & y where you want to click it.
source share