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 Build a Self-Destructing Message Android App Starting the App Adding the Login Screen

Fragment.xml

When I create a new activity, there is a new activity plus a fragment activity with the same name. I want to to know why is there a fragment activity and which activity I should use.

2 Answers

Thiam Hock Ng
Thiam Hock Ng
22,131 Points

If I am not wrong, the fragment activity is something new for the latest version of Android ADT, and it is also the recommended way to develop Android applications. You can do whatever that is shown on the MainActivity to the fragment activity.

You can read more about fragments over here: http://developer.android.com/guide/components/fragments.html

If you want to concentrate on just the MainActivity instead of fragment, you can follow the instruction in this video: http://teamtreehouse.com/library/android-tools/getting-started-with-android-studio/fragments-and-layouts

Though it is shown in Android Studio, but the steps are similar to using Eclipse as well. Hope this help!

Thank you for your help! I figured out I should use the fragment xml.