Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Andrew McCormick
17,730 PointsSimple Android Swipe with sound app
I'm wanting to build a simple app for my son where he just swipes through pages. Each page will just be an image and then play a sound file. Basically like this: https://play.google.com/store/apps/details?id=com.lockeandev.ThingsThatGoFree&feature=search_result#?t=W251bGwsMSwyLDEsImNvbS5sb2NrZWFuZGV2LlRoaW5nc1RoYXRHb0ZyZWUiXQ..
I've found some great code example with swipe, but most of them are all swiping through images. I started to create one but it was going to require a .java file for each page, plus a lot of loops to check what page it's on to determine what should be displayed next. I'm assuming there's a more efficient way to do this. Anyone have any code examples or keywords that I should be searching for in the Android documentation? thanks.
3 Answers
Ben Jakuben
Treehouse TeacherI wonder if a simple Gallery would work? You could configure it to fill the screen and then override the onFling() method to control the flow of the images and possibly play a sound with a MediaPlayer.
If this isn't what you want then I'd be more than happy to go over some other ideas.
Andrew McCormick
17,730 Pointsthanks, I'll try out onFling().
Nicholas Wimsatt
Courses Plus Student 1,086 PointsThis is off topic to the discussion but I noticed Andrew's link on the first post has a bad word-wrap on Firefox version 17. A word break on the question CSS class should fix that up.
Thanks for sharing this information guys!