This is very simple to accomplish
If you want to change it in code, call:
1 2 |
setTitle("My new title"); getActionBar().setIcon(R.drawable.my_icon); |
And set the values to whatever you please.
Or, in the Android manifest XML file:
1 2 3 |
<activity android:name=".MyActivity" android:icon="@drawable/my_icon" android:label="My new title" /> |
To enable the back button in your app use:
1 2 |
getActionBar().setHomeButtonEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true); |
The code should all be placed in your onCreate
so that the label/icon changing is transparent to the user, but in reality it can be called anywhere during the activity’s lifecycle.