We can change the ActionBar title in one of two ways:
In the Manifest: in the manifest file, set the label of each Activity.
android:label="@string/TitleWhichYouWantToDisplay"
In code: in code, call the setTitle() method with a String or the id of String as the argument.
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
setTitle(R.string.TitleWhichYouWantToDisplay);
// OR You can also use the line below
// setTitle("MyTitle")
setContentView(R.layout.activity_main);
}
}