Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android

Alejandro Crespo
Alejandro Crespo
6,628 Points

About tabbed activities in Android Studio.

I'm working on the "Build a Self-Destructing Message App". This is the first time I've created a tabbed Activity and I notice that I have two XML files, instead of the usual initial just one of the Main Activity. Perhaps I am being paranoid since my Android Studio has been buggy in the last two days, but of the two XML files, "fragment_main" and "activity_main" only the former has a Relative Layout while the latter has only a Custom View whose id is "pager". Is this normal and I'm just paranoid, or did my build fail?

2 Answers

Hello,

As to my original response(deleted), I had mixed the start of this project up with another project. For this project, I believe you are going to be using Fragments and that everything that you have is completely normal. Fragments a essentially just a part of an Activity and an Activity can actually change between many Fragments. I believe everything should work for you. The xml file you'll want to be editing for changing how the Fragment looks is fragment_main.xml. Please let us know if this helps or if you need more help and we can try more to assist you.

Alejandro Crespo
Alejandro Crespo
6,628 Points

Sup, James. Thank you for responding. So, ActionBarActivity is deprecated, and that gave me rendering problems. I checked out the Android dev page and saw that now AppCompatActivity is all the rage. I added it to the manifest and in my main activity and now the rendering problems went away. Still kind of confused, though. What is the customView widget that the main Activity got built with? Is that so I can later plug in the fragment views into the mainActivty xml, kind of like with listViews? I also had to create a ViewPager class for the rendering problems to go completely away, is that normal too?