Help get this topic noticed by sharing it on Twitter, Facebook, or email.

HeadFirst Android Development - Chapter 9

Hi,

I cannot get my icons to show in the ActionBar, and I copied the exact code that is in the textbook; I have all the other functionality; it's just that the icons won't show. I added my icon in drawable folder hdpi, mdpi, etc. Still can't see my icon... Please help me! What am I doing wrong?

Thank you,

Riddhi
1 person has
this question
+1
Reply
  • Hi Riddhi.

    I asked the authors about the issue you've encountered. Here is their response:
    ------------------------------------

    This appears to be an error that was reported recently. It was registered as an erratum here:
    http://www.oreilly.com/cs/portal/edit...

    The solution is to modify the menu_main.xml file.

    If you're using activities that extend Activity or one of its subclasses, prefix showAsAction with android:. If your activities extend AppCompatActivity, ActionBarActivity or one of its subclasses, prefix showAsAction with app:.

    The solution on the GitHub repo has this:
    https://github.com/dogriffiths/HeadFi...
    ---------------------------------------

    I hope that resolves the problem.

    Best,

    -Dawn
    Associate Editor
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Hi Dawn,

    Thank you for getting back to me. I still cannot view the icons. I changed the app to android:showAsAction caused more errors. I extended my MainActivity to ActionBarActivity, caused more errors. I then copied and pasted the code from the website(menu_main.xml, MainActivity, OrderActvity, styles.xml, etc. However, still no icons :(

    https://github.com/dogriffiths/HeadFi...

    I just wanted to add that I copied and pasted the icon in the drawable-hdpi, mdpi, etc folder. In addition, I also downloaded from the Android Developer website. I was confused with the directions in the text on how to place pictures and where.

    What am I doing wrong?

    Thank you for your time,

    Riddhi
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Hi Riddhi.

    The authors said that the next thing to try is to download the entire project from the GitHub repo for that chapter and try running that.

    I hope that helps.

    Best,

    -Dawn
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated