0

I have a list view with a set of items in it. I user the ACTION_DOWN, ACTION_MOVE, and ACTION_UP events to perform gesture detection on the list items.

In ACTION_MOVE, I have the following line of code : mDownView.setTranslationX(deltaX);

where deltaX is motionEvent.getRawX() - mDownX; mDownX is the X co-ordinate of the ACTION_DOWN event.

The problem I am facing is that the list item movement is not smooth.It appears choppy. What can I do to make it look fluid ?

Please note that I am making a database call in ACTION_MOVE (Code snippet below).

case MotionEvent.ACTION_MOVE: {
            // Check the view type
            Log.d(tag, "------- IN ACTION MOVE -------");

            if (mVelocityTracker == null || mPaused) {
                break;
            }
            // the line below slows down the swipe

            DataBaseHandler db = new DataBaseHandler(mcontext);

            int status = db.getStatus(row_id);
newbie
  • 1,049
  • 5
  • 15
  • 29
  • You should not make a new db instance every time. Make one in your onCreate or somewhere and just keep the reference and re-use it. action_move gets called many many times very fast. Your lookup is probably slowing it down and making chopy. – FoamyGuy Mar 24 '13 at 14:43
  • changed the db call to on ACTION_DOWN, it is still not smooth. Any other suggestions ? – newbie Mar 25 '13 at 21:24

0 Answers0