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

Android

JS Park
JS Park
15,959 Points

What is the difference between a blank activity and an empty activity?

In the video, there is no option for "empty activity", but in the newer version of Android Studio there is "empty activity", which seems to be closer to what "blank activity" was in the past. What exactly is the difference between the two?

1 Answer

Kourosh Raeen
Kourosh Raeen
23,733 Points

If you choose Blank Activity then you will have the option of having the activity use a Fragment. Also, Android Studio will automatically create two layout files for the activity, three if you choose the Fragment option, and also a menu resource file.

If you choose Empty Activity then you get to choose whether or not you want Android Studio to generate a layout file for the activity. If you choose the layout file option Android Studio will create one layout file, as opposed to two layout files in case of Blank Activity, and no menu resource file. Also, the layout file is much simpler and does not contain things like: Coordinator Layout, Floating Action Button, etc., whereas the layout file for Blank Activity contains these items, assuming you are using the latest version of Android Studio.

JS Park
JS Park
15,959 Points

Thank you very much for the detailed and clear explanation!! :)