November 13th, 2012, 01:40 PM
Thread Author (OP)
Join Date: Nov 2010
Device(s): HTC Desire HD, Samsung Galaxy SII, Samsung Galaxy Nexus, ASUS Nexus 7
Carrier: Not Provided
Thanked 8 Times in 7 Posts
Fragments for Horizontal scrolling, use onClicks to move to certain Fragments?
Hopefully this is do-able.
I've set up a horizontal scrolling system using FragmentPagerAdapter. Is there a way that I can click on an TextView/ImageView and then it'll take me to one of my Fragments? I want to improve the UI of my app by giving the user the option to scroll left and right but to also click a few buttons on my first Fragment to go to each of the screens too.
Is this possible?
I tried an ordinary OnClickListener but that gives me a force close. Mostly because I used startActivity() and I'm not trying to start an activity rather a Fragement but I don't know how to do that.
Overall maybe there is an easier way though, I've seen apps that have horizontal scrolling and when you click a button on one page you see the scrolling animation take them to the requested page.
Like I said I have an ordinary FragmentPagerAdapter set up with all the code it's just getting this final bit of the puzzle.
Any help would be greatly appreciated.