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 Build a Simple Android App (retired 2014) Pretty Little Things Adding an Image

Adding an Image Issues

I am on the android basic development section Adding an Image, and I am not able to upload the emulator

5 Answers

Siddharth Saravanan
Siddharth Saravanan
1,208 Points

Can you be a little more specific. If you do I might be able to help.

Sorry for the vague response. In the add the image video for android development, we switched the appTheme to Theme.Black.NoTitleBar.Fullscreen in the activity_main Graphical Layout section. Then, going into Android Manifest.xml / browse Theme / click system resource / click Theme.Black.NotTitleBar.Fullscreen. Running the application on my emulator gives me an error message, saying the app cannot be run.
In his tutorial, he told us to copy and paste a specific code into two areas to fix the problem, but I am not learning anything that way.

Thank you

Siddharth Saravanan
Siddharth Saravanan
1,208 Points

Ok so here are the steps

1) Change your project back to using "AppTheme" like it was before.

2) Add the following two lines to the file res/values/styles.xml(inside the <style name="AppTheme"> tag):

            <item name="android:windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item>

The whole thing will look like this

<resources>

<!--
    Base application theme, dependent on API level. This theme is replaced
    by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.
    -->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item>
</style>

</resources>

3) Set the background color to black in the file res/layout/activity_main.xml. The root element, RelativeLayout, is the one that makes up the whole screen. Add this line in the RelativeLayout after the layout_height line but before the closing angle bracket >:

android:background="@android:color/black"

4) Go to the AndroidManifest.xml, click Browse Theme, then click PROJECT resource, then search or click AppTheme.

Now save everything and try running your app and see what happens, make sure to tell me!

If you still have the action bar in the app, click this link to a discussion in the forum that can help you with that. https://teamtreehouse.com/forum/same-code-different-models-different-screens

Hope I helped.

Ben Hurd
Ben Hurd
541 Points

Hi Guys,

It's the first step, change project back to "AppTheme", that is confusing me... how do I do that?

Thanks :)

Ben Hurd
Ben Hurd
541 Points

Apologies, worked it out - I realised that was a dumb question when I wrote it, got confused for a moment!