0% found this document useful (0 votes)
36 views3 pages

PB2 Program 3

The document describes an SMS application with an XML layout file and Kotlin code. The XML layout contains three buttons - one to display the SMS number, another to display the SMS message, and a text view to display the output. The Kotlin code defines a MainActivity class that sets the content view to the XML layout file on creation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views3 pages

PB2 Program 3

The document describes an SMS application with an XML layout file and Kotlin code. The XML layout contains three buttons - one to display the SMS number, another to display the SMS message, and a text view to display the output. The Kotlin code defines a MainActivity class that sets the content view to the XML layout file on creation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1 Program 10: SMS Application

XML Code:
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<com.google.android.material.button.MaterialButton
android:id="@+id/display_number"
android:layout_width="wrap_content"
android:layout_height="54dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:text="Display SMS Number"
app:layout_constraintBottom_toTopOf="@+id/display_message"
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.26"
app:layout_constraintVertical_chainStyle="packed" />

<com.google.android.material.button.MaterialButton
android:id="@+id/display_message"
android:layout_width="wrap_content"
android:layout_height="54dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:text="Display SMS Message"
app:layout_constraintBottom_toTopOf="@+id/textbox"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/display_number" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/textbox"
android:layout_width="match_parent"
android:layout_height="100sp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/display_message" />

</androidx.constraintlayout.widget.ConstraintLayout>

Mobile Application Development – 18CSMP68


2 Program 10: SMS Application

Kotlin:
package `in`.edu.REC.smsapplication

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class MainActivity : AppCompatActivity() {


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}

Mobile Application Development – 18CSMP68


3 Program 10: SMS Application

Output:

Mobile Application Development – 18CSMP68

You might also like