I want to implement swiping between two pages. The first page is a ListFragment, with a couple of items. I want to be able to swipe a single item and switch to another Activity to do some processing of that ListItem.
I’ve implemented Activity switching using ViewPager – which seems the most reasonable way to handle this. However I don’t know how to get the swiped item from the ListFragment when switched to the other screen.
I know there is onListItemClick(), but don’t know if it allows to fetch item index after swipe. According to what I’ve found – it doesn’t.
Any ideas?
I’ve managed to do this using the following overloaded ViewPager class:
Note that I’m calling gestureScanner once again in onTouchEvent. I suppose I could wire somehow the custom getsutureScanner so that it would be handling all the touch events. However since I’m not familiar with how ViewPager events are handled, I’ve decided to call my own handler side by side.
If there is a better way to do this – please let me know.