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!
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
Akash malhotra
3,025 PointsHow do i remove action bar?
I'm on the fun facts app for android. In the video, there was an option when ctrl+space was clicked, to remove the actionbar(.NoActionBar). For my theme, i don't get that option. I tried editing the manifest file and styles files from what people said on google, but then i had rendering issues, so I reversed everything back to normal. How can i remove the action bar for appcombat insted of holo.light in the video.
Ps. I also tried changing the theme to the exact theme in the video(halo,light), but i got alot of errors probaly cuz i didn't change it somewhere else.
1 Answer

Nicolas Hampton
44,638 PointsIf I remember correctly Akash, this is something you're going to have to do in the java code itself. Start by declaring an action bar named actionBar and setting it with getActionBar, like this I think:
ActionBar actionBar = getActionBar();
From there, if you type the actionBar variable and use auto complete, it should give you a list of usable methods. I think the one you're looking for is hide() or something like that (I'm on the bus on my phone). You want to put all this at the beginning of the on create method for the activity you are trying to hide it in. Let me know if that works for ya. Happy coding!
Nicolas
Akash malhotra
3,025 PointsAkash malhotra
3,025 PointsWhere exactly should i declare this? If i do it in the public class, i get multiple errors.
Nicolas Hampton
44,638 PointsNicolas Hampton
44,638 PointsIn onCreate
Akash malhotra
3,025 PointsAkash malhotra
3,025 PointsWhat you typed wasn't working so with a bit of tweaking, i got this to show no errors, so i assume it's right. Also, when it try to test this on my emulator, i pressed run and my emulator didn't remove the action bar? it still shows funfacts action bar on top.
Nicolas Hampton
44,638 PointsNicolas Hampton
44,638 PointsThat's what I use and it works. If that doesn't work, then I don't know. Make sure that the imports for the action bar are from the support library, but this works fine for me.