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 trialevgeniylischuk
5,265 PointsWhy do we have to create separate class (RibbitApplication) beside our Activity?
As I see it, we create Activity with OnCreate method in it. What for we need to replace it with new class RibbitApplication.onCreate()? Why we can't use Activity instead?
2 Answers
Ben Deitch
Treehouse TeacherThe short answer is that we want to use the Parse SDK, and that's what the Parse documentation tells us to do :). The longer answer is that activities can be started, stopped, and destroyed all while the application is still running. For example, if you have an app that switches between activities you could end up calling each activity's onCreate method several times. By putting the Parse initialization code in a class that extends Application we can be sure that it only gets called once when the app is created.
evgeniylischuk
5,265 PointsUnderstood. Thank you very much