Archive

Posts Tagged ‘set icon’

How to set icon for title bar in Android?

December 8, 2009 1 comment

In android we have the facility to set a icon for title bar.

see the below image here the title bar contains only title.
Title name is Iconic Memorey

How to set icon in title bar?.
use this.

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_RIGHT_ICON);
setContentView(R.layout.main);
setFeatureDrawableResource(Window.FEATURE_RIGHT_ICON, R.drawable.icon);
}

By using this code we can get the output like below image

Advertisements