In this tutorial we will change the title of Actionbar of an activity using android studio...
Step 1: Create a new project or open your project
Step 2: activity_main.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:gravity="center"tools:context=".MainActivity"><TextViewandroid:text="Hello World!"android:layout_width="wrap_content"android:layout_height="wrap_content" /></LinearLayout>
Step 3: MainActivity.java
package com.blogspot.devofandroid.myapplication;import android.os.Bundle;import android.support.v7.app.ActionBar;import android.support.v7.app.AppCompatActivity;public class MainActivity extends AppCompatActivity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);//set actionbar titleActionBar actionBar = getSupportActionBar();actionBar.setTitle("New Title");}}
0 Response to "Change Actionbar Title Of An Activity Programmatically In Android Studio"