MainActivity:
package com.cscorner.myapplication5
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
//Bundle is a class in android studio used to transfer data from one UI component activity to another UI component activity to another UI component activity.
import android.widget.Toast
class MainActivity : AppCompatActivity()
{
override fun onCreate(savedInstanceState: Bundle?)
{
//Bundle defines 2 methods onFreeze() and onCreate() onFreeze() assigns value to UI component in design phase and onCreate() takes parameter of component during runtime
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
//R is a resource set in activity_main.xml and used in kt file with resource id
}
}
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:minHeight="48dp"
android:textAllCaps="true"
android:textColor="#289428"
android:text="MAD LAB"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5" />
</androidx.constraintlayout.widget.ConstraintLayout>