Posts

Showing posts with the label change actionbar title programmatically

Change Actionbar title of an activity programmatically (Kotlin)- Android Studio

Image
In this tutorial we will change the title of Actionbar of an Activity in Kotlin using Android Studio ... Step 1: Create a new Project OR Open you project Step 2: Code MainActivity.kt package com.blogspot.atifsoftwares.kotlinpractice import android.support.v7.app.AppCompatActivity import android.os.Bundle class MainActivity : AppCompatActivity() { override fun onCreate (savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) //to change title of activity val actionBar = supportActionBar actionBar!!.title = "New Title" } } Step 3: Output

Change Actionbar title of an activity programmatically in Android Studio

Image
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" > <TextView android: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 ; impor...