FONT AND COLOURS Exp : 1 Aim : Develop an application that uses GUI components, Font and Colours MainActivity.kt : class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout. ativity_main ) val a = findViewById<TextView>(R.id. tvLoginTitle ) val b = findViewById<EditText>(R.id. etPassword ) val d = findViewById<Button>(R.id. btnLogin ) d .setOnClickListener { val name = b. text .toString() a. text = "Welcome $name " a.setTextColor(android.graphics.Color.parseColor("Blue")) } } } activity_main.xml : < LinearLayout xmlns:android ="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="24dp" android:gravity="center" android:background="@color/pure_re d"> < TextView android:id="@+id/tvLoginTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="32dp" android:text="Welcome " android:textSize="28sp" android:textStyle="bold" android:fontFamily="sans - serif" android:textColor="@color/white"/> Layout : Emulator : < EditText android:id="@+id/etPassword" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Enter your Name" android:textColorHint="@color/purple_700" /> < Button android:id="@+id/btnLogin" android:layout_width="match_parent" android:layout_heig ht="wrap_content" android:text="Login" android:textColor="@color/my_opaque_red" android:layout_marginTop="24dp" /> </ LinearLayout > Result : The program to Develop an application that uses GUI components, Font and Colours is execu ted and display INTENT Exp : 2 Aim : Develop an application that uses Layout Managers and event listeners. MainActivity.kt : class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) enableEdgeToEdge () setContentView(R.layout. activity_main ) val reg = findViewById<EditText>(R.id. edit1 ) val name = findViewById<EditText>(R.id. edit2 ) val spin = findViewById<Spinner> (R.id. spinner ) val btn = findViewById<Button>(R.id. btnsumbit ) val dept = arrayOf ("ECC","BT&SP","BSM","BCOM") val adapter = ArrayAdapter(this, android.R.layout. simple_spinner_item ,dept) adapter.setDropDownViewRes ource(android.R.layout. simple_spinner_dropdown_item ) spin. adapter =adapter btn.setOnClickListener { val reg = reg. text .toString(). toInt () val name = name. text .toString() val dept = spin. selectedItem .toStr ing() val intent = Intent(this, MainActivity2 :: class. java ) intent.putExtra("Regno",reg) intent.putExtra("Name",name) intent.putExtra("Dept",dept) startActivity(intent) } } } MainAct ivity2.kt : class MainActivity2 : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) enableEdgeToEdge () setContentView(R.layout. activity_main2 ) val regno = inten t .getStringExtra("Regno") Layout : Emulator : val name = intent .getStringExtra("Name") val dept = intent .getStringExtra("Dept") val reg = findViewById<TextView>(R.id. regno ) val nam = findViewById<TextView >(R.id. name ) val dep = findViewById<TextView>(R.id. dept ) reg. text = regno. toString () nam. text = name. toString () dep. text = dept. toString () } } activity_main.xml : < LinearLayout xmlns:android ="http://schemas.android.com/apk/res/android" android:id="@+id/main" android:gravity="center" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> < TextView android:layout _width="wrap_content" android:layout_height="wrap_content" android:text="Student Details" android:textSize="40dp"/> < TableLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> < TableRow android:layout_width="wrap_content" android:layout_height="wrap_content"> < TextView android:id="@+id/regno" android:layout_width="wrap_content" android:layout_ height ="wrap_content" android :text ="Reg_No :" android:textSize="38dp"/> < EditText android:id="@+id/edit1" android:layout_width="wrap_content" android :layout_height="wrap_content" android:textSize="38dp" /> </ TableRow > < TableRow android:layout_width="wrap_content" android:layout_height="wrap_content"> < TextView android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Name :" android:textSize="38dp"/> < EditText a ndroid:id="@+id/edit2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="38dp" /> </ TableRow > < TableRow android:layout_width="wrap_content" android:layout_height="wrap_content"> < TextView android:id="@+id/dept" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Dept :" android:textSize="38dp"/> < Spinner android:id="@+id/spinner" android:layout_width="match_parent" android android:textS ize="38dp" /> </ TableRow > </ TableLayout > < Button android:id="@+id/btnsumbit" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Submit" android:textSize="38dp"/> </ LinearLayout > activity_main2.xml : < LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center"> < TextView android:id="@+id/regno" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Regno :" android:textSize="40dp" android:layout_grav ity="center"/> < TextView android:id="@+id/name" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Name :" android:textSize="40dp" android:layout_gravity="cente r"/> < TextView android:id="@+id/dept" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Dept :" android:textSize="40dp" android:layout_gravity="center"/> </ LinearLayout > Result : The program to Develop an application that uses Layout Managers and event listeners is executed and display CALCULATOR Exp : 3 Aim : Develop a native calculator application. MainActivity.kt : class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) enableEdgeToEdge () val btnp = findViewById<Button>(R.id. btnplus ) val btnm = findViewById< Button>(R.id. btnminus ) val btni = findViewById<Button>(R.id. btnmulti ) val btnd = findViewById<Button>(R.id. btndiv ) val t1 = findViewById<EditText>(R.id. txt1 ) val t2 = findViewById<EditText>(R.id. txt2 ) val result = f indViewById<TextView>(R.id. result ) btnp.setOnClickListener{ val s = t1. text .toString(). toInt () + t2. text .toString(). toInt () result. text = "$s" } btnm.setOnClickListener { val s = t1. text .toString (). toInt () - t2. text .toString(). toInt () result. text ="$s" } btni.setOnClickListener { val s = t1. text .toString(). toInt () * t2. text .toString(). toInt () result. text ="$s" } btnd.setOnClickListe ner { val s = t1. text .toString(). toInt () / t2. text .toString(). toInt () result. text ="$s" } } } Layout : Emulator :