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!
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

Morgan Davis
Courses Plus Student 336 PointsBest way to implement a swipe to refresh in the new Stormy weather app?
I'm having issues adding in a swipe to refresh gesture on the weather app course as a little extra credit. I've got the code figured out for the XML file activity_main but I'm having issues setting up the adapter for the MainActivity.java, has anyone else been able to get this accomplished? Please help a newb out! Ben Jakuben
2 Answers

Ben Jakuben
Treehouse TeacherI have just the thing that might help from another course (later in the track): Adding a SwipeToRefresh Gesture.

Ben Jakuben
Treehouse TeacherSince you are calling directly from an Activity class, you don't have or need a rootView
in this line of code.
mSwipeRefreshLayout = (SwipeRefreshLayout)rootView.findViewbyID(R.id.swipeRefreshLayout);
Try this instead:
mSwipeRefreshLayout = (SwipeRefreshLayout) findViewbyID(R.id.swipeRefreshLayout);
Morgan Davis
Courses Plus Student 336 PointsMorgan Davis
Courses Plus Student 336 PointsBen, thank you so much for the quick reply! Only question I have is with the changes in the new api 21, will all of this still work? Issue I'm having is 1. It gives me an error using rootView in "mSwipeRefreshLayout = (SwipeRefreshLayout)rootView.findViewbyID(R.id.swipeRefreshLayout);". Might be easier if I just paste what I have, if that's okay.