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 an Interactive Story App (Retired) User Input Hiding the ActionBar with an App Theme

App keeps crashing when using android:Theme.Holo.Light.NoActionBar

I change my AppThem from parent="Theme.AppCompat.Light.DarkActionBar" to "android:Theme.Holo.Light.NoActionBar.Fullscreen" and the app keeps crashing at launch

Nelson Pantaleon
Nelson Pantaleon
7,025 Points

What happens is that your "MainActivity.java" file class must extend the "Activity" class instead of the "ActionBarActivity" its inheriting from. Once you change it (extends Activity) and make sure you include

 "import android.app.Activity;" 

at the beginning, you should be able to follow along with the video.

4 Answers

Quincy Leito
Quincy Leito
20,503 Points

Change it to:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
</style>

If you don't want to have an actionbar on the screen. Hope it works.

OZGUR KISIR
OZGUR KISIR
1,767 Points

I have the same problem. changed the line as <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

but still I see action bar when I run the program on emulator. And I don't have a directory like stated inside the video like 'values-21'

Hariidaran Tamilmaran
seal-mask
.a{fill-rule:evenodd;}techdegree
Hariidaran Tamilmaran
iOS Development Techdegree Student 19,305 Points

What I did was, remove the line import android.support.v7.app.AppCompatActivity;, because I guessed it's a class which lets the activity have only AppCompat themes, and not other themes. Therefore, your code would look like this:

MainActivity.java
package com.yournamehere.interactivestory;

import android.app.Activity;
import android.os.Bundle;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Your other code goes after this
    }
}

I hope this helps!

Kyle Baker
Kyle Baker
8,211 Points

I was having a similar issue when I was trying to get the action bar to display. I removed

<android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"/>

</android.support.design.widget.AppBarLayout>

from my activity_main.xml file and then I had a functioning actionbar. So, maybe try this?