Android – Activity Constructor vs onCreate

By | July 5, 2019


I understand that Android Activities have specific lifecycles and that onCreate should be overridden and used for initialization, but what exactly happens in the constructor? Are there any cases when you could/should override the Activity constructor as well, or should you never touch it?

I’m assuming that the constructor should never be used because references to Activities aren’t cleaned up entirely (thus hampering the garbage collector) and that onDestroy is there for that purpose. Is this correct?


I can’t think of any good reason to do anything in the constructor. You never construct an activity directly, so you can’t use it to pass in parameters. Generally, just do things in onCreate.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *