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

Cannot create fragment

In Android Studio, I was going to create a fragment activity. I went for file>new>fragment, but it doesn't response only to have xml layout file when I choose to make one. Also I tried to do so with right click on app package: com.blahblah but still it doesn't say anything. I tried Rebuild, Restart, Check message error and Event Log but everything seems fine.

2 Answers

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

I can't tell exactly what you are trying to do. If you right-click on the package name, you can select New > Activity > Blank Activity with Fragment and use the wizard to create a new Activity and Fragment. Is that what you are looking for? Or just a regular new Fragment? That's also available via New > Fragment > Blank Fragment.

I was talking about java class to maintain, say the fragment for Inbox. In the video, I think it was InboxFragment.java for fragment_inbox.xml.

I try to create with right-click > New > Fragment, but there is no response with Blanck Fragment option. I click the option, the dialog is dismissed, and nothing happens. But apparently I don't need it for now since I can make it by myself with blank java class with Fragment extended.