Ese Android U2
Ese Android U2
Ese Android U2
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
ASSIGNMENT-I
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
ASSIGNMENT-II
1>Write a Kotlin program in Android to display a welcome message to the user on a click of a Button
using Toast
XML FILE
<?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">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="156dp"
android:layout_marginTop="288dp"
android:text="Button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
KT FILE
package com.example.prg1
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle import
android.widget.Button import
android.widget.Toast
}
}
OUTPUT
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
3> Write a Kotlin program in Android to accept a text from the user using Edit Text control and
provide 2 buttons to the user “Bold” and “Italic”. Display the user text in a Text View Control after
formatting it.
XML FILE:
<?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">
<EditText
android:id="@+id/editTextTextPersonName"
android:layout_width="219dp"
android:layout_height="79dp"
android:layout_marginStart="108dp"
android:layout_marginTop="196dp"
android:ems="10"
android:inputType="textPersonName"
android:text="Dhruvnarayan Rawal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="192dp"
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
android:layout_marginTop="376dp"
android:text="DHRUV"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="88dp"
android:layout_marginTop="500dp"
android:text="BOLT"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="500dp"
android:layout_marginEnd="88dp"
android:text="ITALIC"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
KT FILE:
package com.example.prg3
import
android.annotation.SuppressLint import
android.graphics.Typeface
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle import
android.widget.EditText import
android.widget.Button import
android.widget.TextView
class MainActivity : AppCompatActivity()
{ @SuppressLint("MissingInflatedId")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val input = findViewById<EditText>(R.id.editTextTextPersonName)
val output = findViewById<TextView>(R.id.textView) val btnB =
findViewById<Button>(R.id.button) val btnI =
findViewById<Button>(R.id.button1) btnB.setOnClickListener {
var x = input.text.toString() output.text = x
output.setTypeface(null,Typeface.BOLD)
}
btnI.setOnClickListener {
var x = input.text.toString()
output.text = x
output.setTypeface(null,Typeface.ITALIC)
}
}
}
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
OUTPUT
4> Write a Kotlin program in Android to demonstrate the use of Floating Label.
XML FILE:
<?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.textfield.TextInputLayout
android:layout_width="409dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="Enter
your name" />
</com.google.android.material.textfield.TextInputLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
KT FILE
package com.example.prg4
XML FILE
<EditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="70dp" android:hint="...Enter
Your Name..." android:inputType="text" />
<EditText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="70dp"
android:hint="...Email..."
android:inputType="textEmailAddress"/>
<EditText
android:id="@+id/enroll"
android:layout_width="match_parent"
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
android:layout_height="70dp"
android:hint="...Enrollment No... " />
<EditText
android:id="@+id/number"
android:layout_width="match_parent"
android:layout_height="70dp"
android:hint="...Mobile Number..."
android:inputType="number"/>
<Button
android:id="@+id/register"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:text="Register" app:iconTint="#FFFFFF"
/>
<Button
android:id="@+id/reset"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:text="Reset" />
<TextView
android:id="@+id/result"
android:layout_width="match_parent"
android:layout_height="185dp"
android:foregroundTint="#37E1D1"
android:hapticFeedbackEnabled="true"
android:textSize="24sp" />
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="172dp"
app:srcCompat="@android:drawable/sym_def_app_icon" />
</LinearLayout>
KT FILE
package com.example.prg6
XML FILE
<TextView
android:id="@+id/textView3"
android:layout_width="61dp"
android:layout_height="35dp"
android:layout_marginStart="32dp"
android:layout_marginTop="244dp"
android:layout_marginEnd="22dp"
android:layout_marginBottom="452dp"
android:text="Mobile no"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/editTextTextPersonName3"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
android:id="@+id/textView2"
android:layout_width="52dp"
android:layout_height="27dp"
android:layout_marginStart="32dp"
android:layout_marginTop="148dp"
android:layout_marginEnd="31dp"
android:layout_marginBottom="69dp"
android:text="Email"
app:layout_constraintBottom_toTopOf="@+id/textView3"
app:layout_constraintEnd_toStartOf="@+id/editTextTextPersonName2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/editTextTextPersonName"
android:layout_width="216dp"
android:layout_height="54dp"
android:layout_marginTop="44dp"
android:layout_marginEnd="80dp"
android:ems="10"
android:inputType="textPersonName"
android:text="Enter your name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView"
android:layout_width="52dp"
android:layout_height="27dp"
android:layout_marginTop="56dp"
android:text="Name"
app:layout_constraintBottom_toTopOf="@+id/textView2"
app:layout_constraintEnd_toStartOf="@+id/editTextTextPersonName"
app:layout_constraintHorizontal_bias="0.545"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<EditText
android:id="@+id/editTextTextPersonName2"
android:layout_width="216dp"
android:layout_height="60dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="80dp"
android:ems="10"
android:inputType="textPersonName" android:text="Enter
your email id" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/textView2"
app:layout_constraintTop_toBottomOf="@+id/editTextTextPersonName" />
<EditText
android:id="@+id/editTextTextPersonName3"
android:layout_width="230dp"
android:layout_height="53dp"
android:layout_marginTop="48dp" android:ems="10"
android:inputType="textPersonName"
android:text="Enter your phone no"
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.25"
app:layout_constraintStart_toEndOf="@+id/textView3"
app:layout_constraintTop_toBottomOf="@+id/editTextTextPersonName2"
/>
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="88dp"
android:text="Submit"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editTextTextPersonName3"
/>
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="76dp"
android:text="Reset"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button" />
</androidx.constraintlayout.widget.ConstraintLayout>
KT FILE
package com.example.prg7
import
androidx.appcompat.app.AppCompatActivity import
android.os.Bundle
import android.text.InputFilter.LengthFilter
import android.widget.Button import
android.widget.EditText import
android.widget.Toast
} }
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
OUTPUT
8>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
KT FILE
package com.example.program8_u2
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.ArrayAdapter
import android.widget.ListView
ANDROID MANIFEST.XML
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.Program8_U2"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
</application>
</manifest>
OUTPUT
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
Pr9>Write a Kotlin program in Android to implement the GridView Widget component. Display the
android versions images in a grid format.
<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnWidth="120dp"
android:numColumns="auto_fit"
android:verticalSpacing="16dp"
android:horizontalSpacing="16dp"
android:padding="16dp"
android:gravity="center"
android:stretchMode="columnWidth"/>
KT FILE
package com.example.program9_u2
import ImageAdapter
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.AdapterView
import android.widget.GridView
import android.widget.Toast
IMAGE ADAPTER.KT
import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.ImageView
Pr11> Write a Kotlin program in Android to create a Login application. Provide 2 fields and 2 buttons
“Login” and “Clear”. Check whether the UserId and Password are Correct or not. If correct, redirect
the user to a Welcome page and also pass the username to be displayed on the Welcome Page. If
incorrect, inform the user through Notification.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<EditText
android:id="@+id/userIdEditText"
android:hint="User ID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"/>
<EditText
android:id="@+id/passwordEditText"
android:hint="Password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"/>
<Button
android:id="@+id/loginButton"
android:text="Login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"/>
<Button
android:id="@+id/clearButton"
android:text="Clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"/>
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
</LinearLayout>
KT FILE
package com.example.program11_u2
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.EditText
import android.widget.Toast
// Get the EditText fields and buttons from the XML layout file
userIdEditText = findViewById(R.id.userIdEditText)
passwordEditText = findViewById(R.id.passwordEditText)
val loginButton = findViewById<Button>(R.id.loginButton)
val clearButton = findViewById<Button>(R.id.clearButton)
Code:-
{"info":[
{"name":"Ajay","id":"111","email":"[email protected]"},
{"name":"John","id":"112","email":"[email protected]"},
{"name":"Rahul","id":"113","email":"[email protected]"},
{"name":"Maich","id":"114","email":"[email protected]"},
{"name":"Vikash","id":"115","email":"[email protected]"},
{"name":"Mayank","id":"116","email":"[email protected]"},
{"name":"Prem","id":"117","email":"[email protected]"},
{"name":"Chandan","id":"118","email":"[email protected]"},
{"name":"Soham","id":"119","email":"[email protected]"},
{"name":"Mukesh","id":"120","email":"[email protected]"},
{"name":"Ajad","id":"121","email":"[email protected]"}
Model.kt :-
package example.kttpoint.com.kotlinjsonparsing
constructor(id: String,name:String,email:String) {
this.id = id
this.name = name
this.email = email
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
}
constructor()
adapter_layout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout"
android:padding="5dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tvId"
android:layout_margin="5dp"
android:textSize="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tvName"
android:textSize="16dp"
android:layout_margin="5dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
android:id="@+id/tvEmail"
android:layout_margin="5dp"
android:textSize="16dp"/>
</LinearLayout>
CustomAdapter.kt
Create a custom adapter class CustomAdapter.kt and extend BaseAdapter to handle the
custom ListView.
package example.kttpoint.com.kotlinjsonparsing
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.LinearLayout
import android.widget.TextView
ter(){
init {
this.layoutInflater = LayoutInflater.from(context)
this.arrayListDetails=arrayListDetails
}
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
override fun getCount(): Int {
return arrayListDetails.size
return arrayListDetails.get(position)
return position.toLong()
if (convertView == null) {
listRowHolder = ListRowHolder(view)
view.tag = listRowHolder
} else {
view = convertView
listRowHolder.tvName.text = arrayListDetails.get(position).name
listRowHolder.tvEmail.text = arrayListDetails.get(position).email
listRowHolder.tvId.text = arrayListDetails.get(position).id
return view
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
}
init {
MainActivity.kt
package example.kttpoint.com.kotlinjsonparsing
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.ListView
import android.widget.ProgressBar
import okhttp3.*
import org.json.JSONArray
import org.json.JSONObject
import java.io.IOException
import kotlin.collections.ArrayList
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
progress = findViewById(R.id.progressBar)
progress.visibility = View.VISIBLE
run("http://10.0.0.7:8080/jsondata/index.html")
progress.visibility = View.VISIBLE
.url(url)
.build()
client.newCall(request).enqueue(object : Callback {
progress.visibility = View.GONE
var i:Int = 0
arrayList_details= ArrayList();
var json_objectdetail:JSONObject=jsonarray_info.getJSONObject(i)
model.id=json_objectdetail.getString("id")
model.name=json_objectdetail.getString("name")
model.email=json_objectdetail.getString("email")
arrayList_details.add(model)
runOnUiThread {
obj_adapter = CustomAdapter(applicationContext,arrayList_details)
listView_details.adapter=obj_adapter
progress.visibility = View.GONE
OUTPUT
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
Pr14> Write a Kotlin program in Android to implement XML Parser.
Code:-
activity_main.xml
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/a
pk/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="example.kttpoint.com.kotlinxmlparsingusingxmlpullparser.MainAct
ivity">
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</android.support.constraint.ConstraintLayout>
employees.xml
<employees>
<employee>
<id>1</id>
<name>Sachin Kumar</name>
<salary>50000</salary>
</employee>
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
<employee>
<id>2</id>
<name>Rahul Kumar</name>
<salary>60000</salary>
</employee>
<employee>
<id>3</id>
<name>John Mike</name>
<salary>70000</salary>
</employee>
<employee>
<id>4</id>
<name>Ajay Kumar</name>
<salary>45000</salary>
</employee>
<employee>
<id>5</id>
<name>Toni Nayer</name>
<salary>55000</salary>
</employee>
<employee>
<id>6</id>
<name>Mr Bony</name>
<salary>42000</salary>
</employee>
<employee>
<id>7</id>
<name>Raj Kumar</name>
<salary>30000</salary>
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
</employee>
<employee>
<id>8</id>
<name>Rahul Kumar</name>
<salary>60000</salary>
</employee>
<employee>
<id>9</id>
<name>John Mike</name>
<salary>70000</salary>
</employee>
<employee>
<id>10</id>
<name>Sachin Kumar</name>
<salary>50000</salary>
</employee>
<employee>
<id>11</id>
<name>Rahul Kumar</name>
<salary>60000</salary>
</employee>
<employee>
<id>12</id>
<name>John Mike</name>
<salary>70000</salary>
</employee>
</employees>
Employee.kt
package example.kttpoint.com.kotlinxmlparsingusingxmlpullparser
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
class Employee {
XmlPullParserHandler.kt
package example.kttpoint.com.kotlinxmlparsingusingxmlpullparser
import org.xmlpull.v1.XmlPullParserException
import org.xmlpull.v1.XmlPullParser
import org.xmlpull.v1.XmlPullParserFactory
import java.io.IOException
import java.io.InputStream
class XmlPullParserHandler {
try {
factory.isNamespaceAware = true
when (eventType) {
XmlPullParser.START_TAG -
employee = Employee()
XmlPullParser.END_TAG -
employee?.let { employees.add(it) }
employee!!.id = Integer.parseInt(text)
employee!!.name = text
employee!!.salary = java.lang.Float.parseFloat(text)
else -> {
eventType = parser.next()
}
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
} catch (e: XmlPullParserException) {
e.printStackTrace()
e.printStackTrace()
return employees
MainActivity.kt
package example.kttpoint.com.kotlinxmlparsingusingxmlpullparser
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.ArrayAdapter
import android.widget.ListView
import java.io.IOException
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
try {
employees = parser.parse(istream)
NAME: -DHRUVNARAYAN RAWAL
SUBJECT: ANDROID
ENROLMENT NO: IU2082820063
BRANCH: IMCA
SEMESTER: VI
listView.adapter = adapter
e.printStackTrace()
OUTPUT