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

I am trying to an a camera icon to my action bar on android studio, but i can see any icon. I i see is the "camera" text

I am trying to an a camera icon to my action bar on android studio, but i can see any icon. I i see is the "camera" text in my overflow. below is my me.xml file which is in my menu folder, and also is below is my onCreateOptionsMenu() method

@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.me, menu);
        return true;
    }
<menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      tools:context=".MainActivity">
    <item android:id="@+id/action_logout"
          android:title="@string/menu_logout_lable"
          android:orderInCategory="100"
          app:showAsAction="never"/>

    <item android:id="@+id/action_edit_friends"
          android:title="@string/menu_edit_friends_label"
          />
    <item
        android:id="@+id/action_camera"
        android:title="@string/menu_camera_label"
        android:icon="@drawable/ic_action_camera"
        android:showAsAction="always"

        />

</menu>

1 Answer

i found out why, in my xml file, on the item for the camera

android:id="@+id/action_camera"
android:title="@string/menu_camera_label"
android:icon="@drawable/ic_action_camera"
android:showAsAction="always"
/>

, i changed

 android:showAsAction="always"

to

 app:showAsAction="always"

the difference been changing android: to app: .