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

Android Build a Self-Destructing Message Android App Adding Users Using Parse.com Creating an Account and App on Parse.com

Why 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
Ben Deitch
Treehouse Teacher

The 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.

Understood. Thank you very much