on fling motion (say right to left)i want to change the color of list item. But on scrolling the index is is loss
<p>when i scroll the list, Selected item (whose color is being changed) has return to its previous state i.e. its color is again change to default.
So any one can help??
thanks in advance.
here is my class:</p>

<pre><code> class MyGestureDetector extends SimpleOnGestureListener{ 

        // Detect a single-click and call my own handler.

        @Override 
        public boolean onSingleTapUp(MotionEvent e) {
            ListView lv = getListView();
            int pos = lv.pointToPosition((int)e.getX(), (int)e.getY());
            myOnItemClick(pos);
            lv.invalidate();
            return false;
        }

        @Override 
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
        { 
            ListView lv = getListView();
             int pos = lv.pointToPosition((int)e1.getX(), (int)e1.getY());
            if (Math.abs(e1.getY() - e2.getY()) &gt; REL_SWIPE_MAX_OFF_PATH) 
                return false; 
            if(e1.getX() - e2.getX() &gt; REL_SWIPE_MIN_DISTANCE &amp;&amp; 
                Math.abs(velocityX) &gt; REL_SWIPE_THRESHOLD_VELOCITY) { 
                Log.e("on Fling", " onFling r to l");
                onRTLFling(pos); 
            }  else if (e2.getX() - e1.getX() &gt; REL_SWIPE_MIN_DISTANCE &amp;&amp; 
                Math.abs(velocityX) &gt; REL_SWIPE_THRESHOLD_VELOCITY) { 
                onLTRFling(pos); 
            } 
            return false; 
        } 
    } 
</code></pre>

<p>methods RtoLFling is as follow:</p>

<pre><code>private void onRTLFling(int position) {

        Toast.makeText(this, "Right-to-left fling:"+position, Toast.LENGTH_SHORT).show();

       View v =  getListView().getChildAt(position);

            v.setBackgroundColor(Color.CYAN);
    }
</code></pre>
