Im trying to swipe left and right on a listview and get the viewflipper to swtich. Just like the remeberthemilk app and the default news and weather app on the nexus one (Sw
Here is the way i use. it is prety simple.
When you assign onTouchListener to ViewFlipper, create reference for that listener first.
public class ViewFlipperTouchListener implements OnTouchListener {
....
......
}
ViewFlipperTouchListener listener = new ViewFlipperTouchListener ();
mViewFlipper.setOnTouchListener(listener);
//now you have reference to listener. use it to send on touch event.
mListView.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event){
listener.onTouch(v, event);
return false;
}
});
i simply delegated MotionEvent to viewflipper's onTouchListener by using reference "listener". And return false to imply that event is not consumed on ListView. This will help you to scroll down/up on listview and delegates everything (scroll down/up and swipe left/right ...etc to listener.)..
Believe it. it works nice :D