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

One of my activity screens is displaying the app_name where it should put the activity name

My project is called FindMe and is uploaded and shared on gitHub. The activity in question is my addMedia activity. My selectProfile and splash screen activities show their activity names at runtime as expected. The addMedia activity shows the app_name instead. I see no differences in the xml files.

Ken Alger
Ken Alger
Treehouse Teacher

Michael;

Are you talking about in the Menu Bar?

When I run your project I get the following verbiage in the Menu Bar:

Layout: activity_splash_screen.xml -> Menu Bar text: Welcome to FindMe

Layout: activity_select_profile.xml -> Menu Bar text: FindMe: Profile Selection

Layout: activity_add_media.xml -> Menu Bar text: Add Media

Post back with more details. By the way, great to see someone on Treehouse in the Mid-Willamette Valley! I'm just down the road in Keizer.

Ken

Ken,

Nice to meet you too. I'll be at the Treehouse Meetup 6:30 this evening at Treehouse HQ on Mississippi in Portland in case you are interested.

I have not written any code for menus. I mean the text in the black bar that shows above the layout in design preview for the activity. Maybe this is called the menu bar but I have noticed that the text value at android:Label="" in the android manifest file under the respective activity is what appears there. All except for my .AddMedia activity.

... xml

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="info.sparq.findme" >

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".SelectProfile"
        android:label="@string/captionProfileSelection" >
    </activity>


    <activity
        android:name=".AddMedia"
        android:label="@string/captionAddVisualMedia" >
    </activity>
                <!-- The previous shows app_name at top left in design preview -->
                <!-- instead of text @string/captionAddVisualMedia as intended -->


    <activity
        android:name=".SplashScreen"
        android:label="@string/captionSplashScreen" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest> ...

Michael

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Michael;

I opened your project up again (Android Studio 1.0.2) and I get the same experience as you in the graphical layout editor. However, when the app runs in the emulator I get the results as posted above. I'm not sure why the editor is different from the emulator and an actual device in the Action Bar. I called it the Menu Bar yesterday which was incorrect. I know there can be differences between the editor and reality, but I'm not sure why in this case.

I would take a look at a few posts on Stack Overflow for general info on the subject and perhaps something will pop to mind:

  1. Change title bar text in android
  2. How do i change the Android actionbar title and icon

Happy coding,

Ken