Stack Overflow archive
7 scoreaccepted

Android app icon doesn't show on actionbar

score
7
question views
2.9K
license
CC BY-SA 3.0

The problem with @ZsoltBoldizsár's answer is that you are using ActionBarActivity. Change getActionBar() to getSupportActionBar()

Add the following code in onCreate(Bundle) after you call super.onCreate(Bundle):

java
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setIcon(R.drawable.ic_launcher);

Appcompat-v7 automatically disables setDisplayShowHomeEnabled so you must set it to true to show an icon.

Originally posted on Stack Overflow. Public user contributions are licensed under Creative Commons Attribution-ShareAlike.