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

Android Build a Blog Reader Android App Using Intents to Display and Share Posts Easy Sharing with Intents

why does my share button appear in the footer three dotted button menu? (and not in the activity bar)

I have a allview ax4nano 7inch tablet.

My code is exactly as yours. I use Android Studio and have had no problem so far concerning compatibility or other problems taking your (awesome) courses even though some are on eclipse.

Is this because i have codded something wrong (In the 4 lines i use to describe the action_share button? or is it just because of my tablet?


5 Answers

Hi Radu,

Does your code work OK in the emulator? Either the 'standard' one or Genymotion is fine - I do prefer Genymotion as it loads much more quickly.

From memory, and I haven't touched the Blog Reader app since I first started doing Treehouse courses, the share button is in the Action Bar; maybe that layout is different on a tablet; I don't know!

Have a go with the emulator using a phone emulation and we can go from there. Perhaps grab a screenshot of the app running on the tablet and post us the relevant bit of code - activity_main.xml, perhaps.



Unfortunately my laptop's BIOS does not suport virtualisation so i cannot run an emulator. I did not consider that such a big deal because i just tested everything on my tablet and it worked fine (til now).

this is the menu's xml

<menu xmlns:android="http://schemas.android.com/apk/res/android"

    <item android:id="@+id/action_share"


and here is the screnshow www.webshake.ro/screen.png

and this is the method in the blog web view class

    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_blog_web_view, menu);
        return true;

and idea?

i really appreciate the help and hope i get this right so i won't bother you nice people again :)

Don't apologise for asking questions - that's the whole point!

I don't know the answer so I'm going to go through the course again and see what my menu looks like on my tablet too.

Give me a minute to get up to the same point you're at.



Longest minute EVER!!! lol.

Right, I'm up to the point where the ic_action_share icon has just been added. There's no code bhind it yet, but that's not important.

My xml looks exactly the same as yours does and on the emulator it all runs fine and the action bar is in the right place.

I just installed it on my tablet - a Sony Xperia Z - and it also works fine.

Did you delete the fragment properly? There's tablet-specific screen handling methods in there that might cause a problem.

Have a look at my code in Github: https://github.com/OnlySteveH/BlogReader

See if there's a difference somewhere. I've no idea how to stop an icon appearing in the action bar - and no idea how to get it to appear where yours does! What's that part of the screen even called?!

A careful search on StackOverflow may get you your answer; worth a try.

Sorry I can't be of more use.


Pablo Rocha
Pablo Rocha
10,142 Points

Make sure you have "always" as an app, not android.

    <item android:id="@+id/action_share"